aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOzoneGrif2020-01-31 02:26:12 +0100
committerGitHub2020-01-31 02:26:12 +0100
commitd94b987463169b254ab69a79ddb58e5beccb0941 (patch)
tree51f66cdada6a8e920ba80a3aae76393e0127d825
parent15c806adec22239096a910b92b49fcfb964815bd (diff)
parent2157b66f3ea43137391939992cac4dc901a4ac4e (diff)
downloadldgallery-d94b987463169b254ab69a79ddb58e5beccb0941.tar.gz
Merge pull request #65 from pacien/oz-viewer
viewer improvements
-rw-r--r--compiler/app/Main.hs30
-rw-r--r--compiler/data/viewer/readme.md2
-rw-r--r--compiler/src/Compiler.hs1
-rw-r--r--viewer/.env2
-rw-r--r--viewer/public/config.json4
-rw-r--r--viewer/src/@types/gallery/index.d.ts9
-rw-r--r--viewer/src/assets/scss/buefy.scss3
-rw-r--r--viewer/src/assets/scss/global.scss26
-rw-r--r--viewer/src/assets/scss/theme.scss11
-rw-r--r--viewer/src/components/LdKeyPress.vue49
-rw-r--r--viewer/src/components/LdProposition.vue46
-rw-r--r--viewer/src/components/LdTagInput.vue1
-rw-r--r--viewer/src/main.ts2
-rw-r--r--viewer/src/plugins/fontawesome.ts8
-rw-r--r--viewer/src/plugins/router.ts (renamed from viewer/src/router/index.ts)2
-rw-r--r--viewer/src/store/galleryStore.ts2
-rw-r--r--viewer/src/tools.ts17
-rw-r--r--viewer/src/views/GalleryDirectory.vue8
-rw-r--r--viewer/src/views/GalleryPicture.vue4
-rw-r--r--viewer/src/views/GalleryThumbnail.vue12
-rw-r--r--viewer/src/views/MainGallery.vue (renamed from viewer/src/views/Gallery.vue)28
-rw-r--r--viewer/src/views/MainLayout.vue11
-rw-r--r--viewer/src/views/PanelLeft.vue5
-rw-r--r--viewer/src/views/PanelTop.vue78
-rw-r--r--viewer/vue.config.js3
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
19module Main where 19module Main where
20 20
21import GHC.Generics (Generic)
21import Paths_ldgallery_compiler (version, getDataFileName) 22import Paths_ldgallery_compiler (version, getDataFileName)
22import Data.Version (showVersion) 23import Data.Version (showVersion)
24import Data.Int (Int64)
25import Data.Aeson (ToJSON)
26import Data.Time.Clock.System (getSystemTime, systemSeconds)
23import System.FilePath ((</>)) 27import System.FilePath ((</>))
24import System.Console.CmdArgs 28import System.Console.CmdArgs
25 29
@@ -27,6 +31,12 @@ import Compiler
27import Files (readDirectory, copyTo) 31import Files (readDirectory, copyTo)
28 32
29 33
34data ViewerConfig = ViewerConfig
35 { galleryRoot :: String
36 , generationTimestamp :: Int64
37 } deriving (Generic, Show, ToJSON)
38
39
30data Options = Options 40data Options = Options
31 { inputDir :: String 41 { inputDir :: String
32 , outputDir :: String 42 , outputDir :: String
@@ -77,25 +87,27 @@ main :: IO ()
77main = 87main =
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 @@
1Missing viewer distribution.
2Copy 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
19module Compiler 19module 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 @@
1VUE_APP_I18N_LOCALE=en 1VUE_APP_I18N_LOCALE=en
2VUE_APP_I18N_FALLBACK_LOCALE=en 2VUE_APP_I18N_FALLBACK_LOCALE=en
3VUE_APP_DATA_URL=/gallery/
4VUE_APP_EXAMPLE_PROJECT=../example/out/ 3VUE_APP_EXAMPLE_PROJECT=../example/out/
4VUE_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
20declare namespace Gallery { 20declare 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