SilverBullet pivot to become an offline-first PWA (#403)
This commit is contained in:
+28
-4
@@ -1,5 +1,26 @@
|
||||
import { AppCommand } from "./hooks/command.ts";
|
||||
import { FilterOption, PageMeta } from "../common/types.ts";
|
||||
|
||||
export type PageMeta = {
|
||||
name: string;
|
||||
lastModified: number;
|
||||
lastOpened?: number;
|
||||
perm: "ro" | "rw";
|
||||
} & Record<string, any>;
|
||||
|
||||
export type AttachmentMeta = {
|
||||
name: string;
|
||||
contentType: string;
|
||||
lastModified: number;
|
||||
size: number;
|
||||
perm: "ro" | "rw";
|
||||
};
|
||||
|
||||
// Used by FilterBox
|
||||
export type FilterOption = {
|
||||
name: string;
|
||||
orderId?: number;
|
||||
hint?: string;
|
||||
} & Record<string, any>;
|
||||
|
||||
export type Notification = {
|
||||
id: number;
|
||||
@@ -28,8 +49,9 @@ export type AppViewState = {
|
||||
showCommandPalette: boolean;
|
||||
showCommandPaletteContext?: string;
|
||||
unsavedChanges: boolean;
|
||||
synced: boolean;
|
||||
panels: { [key: string]: PanelConfig };
|
||||
allPages: Set<PageMeta>;
|
||||
allPages: PageMeta[];
|
||||
commands: Map<string, AppCommand>;
|
||||
notifications: Notification[];
|
||||
recentCommands: Map<string, Date>;
|
||||
@@ -65,6 +87,7 @@ export const initialViewState: AppViewState = {
|
||||
showPageNavigator: false,
|
||||
showCommandPalette: false,
|
||||
unsavedChanges: false,
|
||||
synced: true,
|
||||
uiOptions: {
|
||||
vimMode: false,
|
||||
darkMode: false,
|
||||
@@ -76,7 +99,7 @@ export const initialViewState: AppViewState = {
|
||||
bhs: {},
|
||||
modal: {},
|
||||
},
|
||||
allPages: new Set(),
|
||||
allPages: [],
|
||||
commands: new Map(),
|
||||
recentCommands: new Map(),
|
||||
notifications: [],
|
||||
@@ -94,9 +117,10 @@ export const initialViewState: AppViewState = {
|
||||
export type Action =
|
||||
| { type: "page-loaded"; meta: PageMeta }
|
||||
| { type: "page-loading"; name: string }
|
||||
| { type: "pages-listed"; pages: Set<PageMeta> }
|
||||
| { type: "pages-listed"; pages: PageMeta[] }
|
||||
| { type: "page-changed" }
|
||||
| { type: "page-saved" }
|
||||
| { type: "sync-change"; synced: boolean }
|
||||
| { type: "start-navigate" }
|
||||
| { type: "stop-navigate" }
|
||||
| {
|
||||
|
||||
Reference in New Issue
Block a user