diff options
25 files changed, 255 insertions, 109 deletions
diff --git a/compiler/app/Main.hs b/compiler/app/Main.hs index 4dd6660..e26055f 100644 --- a/compiler/app/Main.hs +++ b/compiler/app/Main.hs | |||
@@ -18,8 +18,12 @@ | |||
18 | 18 | ||
19 | module Main where | 19 | module Main where |
20 | 20 | ||
21 | import GHC.Generics (Generic) | ||
21 | import Paths_ldgallery_compiler (version, getDataFileName) | 22 | import Paths_ldgallery_compiler (version, getDataFileName) |
22 | import Data.Version (showVersion) | 23 | import Data.Version (showVersion) |
24 | import Data.Int (Int64) | ||
25 | import Data.Aeson (ToJSON) | ||
26 | import Data.Time.Clock.System (getSystemTime, systemSeconds) | ||
23 | import System.FilePath ((</>)) | 27 | import System.FilePath ((</>)) |
24 | import System.Console.CmdArgs | 28 | import System.Console.CmdArgs |
25 | 29 | ||
@@ -27,6 +31,12 @@ import Compiler | |||
27 | import Files (readDirectory, copyTo) | 31 | import Files (readDirectory, copyTo) |
28 | 32 | ||
29 | 33 | ||
34 | data ViewerConfig = ViewerConfig | ||
35 | { galleryRoot :: String | ||
36 | , generationTimestamp :: Int64 | ||
37 | } deriving (Generic, Show, ToJSON) | ||
38 | |||
39 | |||
30 | data Options = Options | 40 | data Options = Options |
31 | { inputDir :: String | 41 | { inputDir :: String |
32 | , outputDir :: String | 42 | , outputDir :: String |
@@ -77,25 +87,27 @@ main :: IO () | |||
77 | main = | 87 | main = |
78 | do | 88 | do |
79 | opts <- cmdArgs options | 89 | opts <- cmdArgs options |
80 | |||
81 | buildGallery opts | 90 | buildGallery opts |
82 | 91 | if (withViewer opts) then do | |
83 | if (withViewer opts) then | ||
84 | copyViewer (outputDir opts) | 92 | copyViewer (outputDir opts) |
93 | writeViewerConfig (outputDir opts </> "config.json") | ||
85 | else | 94 | else |
86 | return () | 95 | return () |
87 | 96 | ||
88 | where | 97 | where |
98 | gallerySubdir :: String | ||
99 | gallerySubdir = "gallery/" | ||
100 | |||
89 | buildGallery :: Options -> IO () | 101 | buildGallery :: Options -> IO () |
90 | buildGallery opts = | 102 | buildGallery opts = |
91 | compileGallery | 103 | compileGallery |
92 | (inputDir opts) | 104 | (inputDir opts) |
93 | (galleryOutputDir "gallery" opts) | 105 | (galleryOutputDir opts) |
94 | (rebuilAll opts) | 106 | (rebuilAll opts) |
95 | (cleanOutput opts) | 107 | (cleanOutput opts) |
96 | 108 | ||
97 | galleryOutputDir :: FilePath -> Options -> FilePath | 109 | galleryOutputDir :: Options -> FilePath |
98 | galleryOutputDir gallerySubdir opts = | 110 | galleryOutputDir opts = |
99 | if withViewer opts then outputBase </> gallerySubdir else outputBase | 111 | if withViewer opts then outputBase </> gallerySubdir else outputBase |
100 | where outputBase = outputDir opts | 112 | where outputBase = outputDir opts |
101 | 113 | ||
@@ -105,3 +117,9 @@ main = | |||
105 | >> getDataFileName "viewer" | 117 | >> getDataFileName "viewer" |
106 | >>= readDirectory | 118 | >>= readDirectory |
107 | >>= copyTo target | 119 | >>= copyTo target |
120 | |||
121 | writeViewerConfig :: FilePath -> IO () | ||
122 | writeViewerConfig fileName = | ||
123 | getSystemTime | ||
124 | >>= return . ViewerConfig gallerySubdir . systemSeconds | ||
125 | >>= writeJSON fileName | ||
diff --git a/compiler/data/viewer/readme.md b/compiler/data/viewer/readme.md new file mode 100644 index 0000000..5786878 --- /dev/null +++ b/compiler/data/viewer/readme.md | |||
@@ -0,0 +1,2 @@ | |||
1 | Missing viewer distribution. | ||
2 | Copy the files in "/viewer/dist/*" here, then rebuild the compiler. | ||
diff --git a/compiler/src/Compiler.hs b/compiler/src/Compiler.hs index fc40a76..8819ffc 100644 --- a/compiler/src/Compiler.hs +++ b/compiler/src/Compiler.hs | |||
@@ -18,6 +18,7 @@ | |||
18 | 18 | ||
19 | module Compiler | 19 | module Compiler |
20 | ( compileGallery | 20 | ( compileGallery |
21 | , writeJSON | ||
21 | ) where | 22 | ) where |
22 | 23 | ||
23 | 24 | ||
diff --git a/viewer/.env b/viewer/.env index 59b220a..9092dea 100644 --- a/viewer/.env +++ b/viewer/.env | |||
@@ -1,4 +1,4 @@ | |||
1 | VUE_APP_I18N_LOCALE=en | 1 | VUE_APP_I18N_LOCALE=en |
2 | VUE_APP_I18N_FALLBACK_LOCALE=en | 2 | VUE_APP_I18N_FALLBACK_LOCALE=en |
3 | VUE_APP_DATA_URL=/gallery/ | ||
4 | VUE_APP_EXAMPLE_PROJECT=../example/out/ | 3 | VUE_APP_EXAMPLE_PROJECT=../example/out/ |
4 | VUE_APP_DATA_URL=gallery/ | ||
diff --git a/viewer/public/config.json b/viewer/public/config.json new file mode 100644 index 0000000..7023edb --- /dev/null +++ b/viewer/public/config.json | |||
@@ -0,0 +1,4 @@ | |||
1 | { | ||
2 | "generationTimestamp": 0, | ||
3 | "galleryRoot": "gallery/" | ||
4 | } \ No newline at end of file | ||
diff --git a/viewer/src/@types/gallery/index.d.ts b/viewer/src/@types/gallery/index.d.ts index 25407e8..b112b6d 100644 --- a/viewer/src/@types/gallery/index.d.ts +++ b/viewer/src/@types/gallery/index.d.ts | |||
@@ -18,6 +18,9 @@ | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | declare namespace Gallery { | 20 | declare namespace Gallery { |
21 | interface Other extends Item { | ||
22 | properties: OtherProperties, | ||
23 | } | ||
21 | interface Picture extends Item { | 24 | interface Picture extends Item { |
22 | properties: PictureProperties, | 25 | properties: PictureProperties, |
23 | } | 26 | } |
@@ -31,7 +34,10 @@ declare namespace Gallery { | |||
31 | tags: RawTag[], | 34 | tags: RawTag[], |
32 | path: string, | 35 | path: string, |
33 | thumbnail?: string, | 36 | thumbnail?: string, |
34 | properties: PictureProperties | DirectoryProperties, | 37 | properties: OtherProperties | PictureProperties | DirectoryProperties, |
38 | } | ||
39 | interface OtherProperties { | ||
40 | type: "other", | ||
35 | } | 41 | } |
36 | interface PictureProperties { | 42 | interface PictureProperties { |
37 | type: "picture", | 43 | type: "picture", |
@@ -42,4 +48,5 @@ declare namespace Gallery { | |||
42 | items: Item[] | 48 | items: Item[] |
43 | } | 49 | } |
44 | type RawTag = string; | 50 | type RawTag = string; |
51 | type ItemType = "other" | "picture" | "directory"; | ||
45 | } \ No newline at end of file | 52 | } \ No newline at end of file |
diff --git a/viewer/src/assets/scss/buefy.scss b/viewer/src/assets/scss/buefy.scss index 7fdb883..735ce6a 100644 --- a/viewer/src/assets/scss/buefy.scss +++ b/viewer/src/assets/scss/buefy.scss | |||
@@ -24,8 +24,7 @@ | |||
24 | @import "buefy_variables"; | 24 | @import "buefy_variables"; |
25 | 25 | ||
26 | // 2. Setup your Custom Colors | 26 | // 2. Setup your Custom Colors |
27 | // $linkedin: #0077b5; | 27 | @import "@/assets/scss/theme.scss"; |
28 | // $linkedin-invert: findColorInvert($linkedin); | ||
29 | 28 | ||
30 | @import "~bulma/sass/utilities/derived-variables"; | 29 | @import "~bulma/sass/utilities/derived-variables"; |
31 | 30 | ||
diff --git a/viewer/src/assets/scss/global.scss b/viewer/src/assets/scss/global.scss index 1903c9e..b418911 100644 --- a/viewer/src/assets/scss/global.scss +++ b/viewer/src/assets/scss/global.scss | |||
@@ -32,6 +32,9 @@ | |||
32 | .nowrap { | 32 | .nowrap { |
33 | white-space: nowrap; | 33 | white-space: nowrap; |
34 | } | 34 | } |
35 | .no-scroll-x { | ||
36 | overflow-x: hidden; | ||
37 | } | ||
35 | 38 | ||
36 | .flex { | 39 | .flex { |
37 | display: flex; | 40 | display: flex; |
@@ -44,19 +47,35 @@ | |||
44 | align-items: center; | 47 | align-items: center; |
45 | } | 48 | } |
46 | 49 | ||
50 | // === Links | ||
51 | |||
52 | .link { | ||
53 | color: $link; | ||
54 | cursor: pointer; | ||
55 | text-decoration: none; | ||
56 | &:hover { | ||
57 | color: $link-hover; | ||
58 | } | ||
59 | } | ||
60 | |||
61 | .disabled { | ||
62 | color: $disabled-color !important; | ||
63 | } | ||
64 | |||
47 | // === Scrollbar styling | 65 | // === Scrollbar styling |
48 | 66 | ||
49 | .scrollbar { | 67 | .scrollbar { |
50 | overflow: auto; | 68 | overflow: auto; |
51 | } | 69 | } |
52 | .scrollbar::-webkit-scrollbar { | 70 | .scrollbar::-webkit-scrollbar { |
53 | width: 12px; | 71 | width: 10px; |