aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler/src/Compiler.hs18
-rw-r--r--design-notes.md2
-rw-r--r--viewer/src/@types/gallery.d.ts7
-rw-r--r--viewer/src/store/galleryStore.ts1
4 files changed, 18 insertions, 10 deletions
diff --git a/compiler/src/Compiler.hs b/compiler/src/Compiler.hs
index 73ac8a4..2970102 100644
--- a/compiler/src/Compiler.hs
+++ b/compiler/src/Compiler.hs
@@ -22,6 +22,7 @@ module Compiler
22 ) where 22 ) where
23 23
24 24
25import GHC.Generics (Generic)
25import Control.Monad (liftM2, when) 26import Control.Monad (liftM2, when)
26import Data.List (any) 27import Data.List (any)
27import System.FilePath ((</>)) 28import System.FilePath ((</>))
@@ -33,7 +34,7 @@ import qualified Data.Aeson as JSON
33 34
34import Config 35import Config
35import Input (readInputTree) 36import Input (readInputTree)
36import Resource (buildGalleryTree, galleryCleanupResourceDir) 37import Resource (GalleryItem, buildGalleryTree, galleryCleanupResourceDir)
37import Files 38import Files
38 ( FileName 39 ( FileName
39 , FSNode(..) 40 , FSNode(..)
@@ -53,9 +54,6 @@ defaultGalleryConf = "gallery.yaml"
53indexFile :: String 54indexFile :: String
54indexFile = "index.json" 55indexFile = "index.json"
55 56
56viewerConfFile :: String
57viewerConfFile = "viewer.json"
58
59itemsDir :: String 57itemsDir :: String
60itemsDir = "items" 58itemsDir = "items"
61 59
@@ -63,6 +61,12 @@ thumbnailsDir :: String
63thumbnailsDir = "thumbnails" 61thumbnailsDir = "thumbnails"
64 62
65 63
64data GalleryIndex = GalleryIndex
65 { properties :: ViewerConfig
66 , tree :: GalleryItem
67 } deriving (Generic, Show, ToJSON)
68
69
66writeJSON :: ToJSON a => FileName -> a -> IO () 70writeJSON :: ToJSON a => FileName -> a -> IO ()
67writeJSON outputPath object = 71writeJSON outputPath object =
68 do 72 do
@@ -117,17 +121,13 @@ compileGallery configPath inputDirPath outputDirPath excludedDirs rebuildAll cle
117 resources <- galleryBuilder inputTree 121 resources <- galleryBuilder inputTree
118 122
119 when cleanOutput $ galleryCleanupResourceDir resources outputDirPath 123 when cleanOutput $ galleryCleanupResourceDir resources outputDirPath
120 writeJSON outputIndex resources 124 writeJSON (outputDirPath </> indexFile) $ GalleryIndex (viewerConfig config) resources
121 writeJSON outputViewerConf $ viewerConfig config
122 125
123 where 126 where
124 inputGalleryConf :: FilePath -> FilePath 127 inputGalleryConf :: FilePath -> FilePath
125 inputGalleryConf "" = inputDirPath </> defaultGalleryConf 128 inputGalleryConf "" = inputDirPath </> defaultGalleryConf
126 inputGalleryConf file = file 129 inputGalleryConf file = file
127 130
128 outputIndex = outputDirPath </> indexFile
129 outputViewerConf = outputDirPath </> viewerConfFile
130
131 itemProcessor config cache = 131 itemProcessor config cache =
132 itemFileProcessor 132 itemFileProcessor
133 (pictureMaxResolution config) cache 133 (pictureMaxResolution config) cache
diff --git a/design-notes.md b/design-notes.md
index d59f511..0d7b5c1 100644
--- a/design-notes.md
+++ b/design-notes.md
@@ -234,6 +234,6 @@ By default, the content is rendered in the same ordered as listed in `index.json
234 234
235Items other than directories are displayed by this view, making use of most of the screen space to render the element. 235Items other than directories are displayed by this view, making use of most of the screen space to render the element.
236 236
237This view should as well display the title, description, date, tags and other information associated to the item. Tags in particular are displayed in a grouped manner as determined in `viewer.json`. 237This view should as well display the title, description, date, tags and other information associated to the item. Tags in particular are displayed in a grouped manner as determined in `index.json`.
238 238
239It should be possible to navigate between items of the same directory as the current one through a thumbnail reel and previous/next links. 239It should be possible to navigate between items of the same directory as the current one through a thumbnail reel and previous/next links.
diff --git a/viewer/src/@types/gallery.d.ts b/viewer/src/@types/gallery.d.ts
index 03d21fc..d7645b6 100644
--- a/viewer/src/@types/gallery.d.ts
+++ b/viewer/src/@types/gallery.d.ts
@@ -22,6 +22,13 @@ declare namespace Gallery {
22 galleryRoot: string, 22 galleryRoot: string,
23 } 23 }
24 24
25 interface GalleryProperties {
26 // empty for now
27 }
28 interface Index {
29 properties: GalleryProperties,
30 tree: Item
31 }
25 interface Other extends Item { 32 interface Other extends Item {
26 properties: OtherProperties, 33 properties: OtherProperties,
27 } 34 }
diff --git a/viewer/src/store/galleryStore.ts b/viewer/src/store/galleryStore.ts
index d2b28dd..cd09996 100644
--- a/viewer/src/store/galleryStore.ts
+++ b/viewer/src/store/galleryStore.ts
@@ -77,6 +77,7 @@ export default class GalleryStore extends VuexModule {
77 const root = this.config?.galleryRoot ?? ''; 77 const root = this.config?.galleryRoot ?? '';
78 return fetch(`${process.env.VUE_APP_DATA_URL}${root}index.json`, { cache: "no-cache" }) 78 return fetch(`${process.env.VUE_APP_DATA_URL}${root}index.json`, { cache: "no-cache" })
79 .then(response => response.json()) 79 .then(response => response.json())
80 .then(index => index.tree)
80 .then(this.setGalleryItemsRoot) 81 .then(this.setGalleryItemsRoot)
81 .then(this.indexTags); 82 .then(this.indexTags);
82 } 83 }