mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-09 23:15:36 +00:00
feat: recreate dashboard page from previous version
This commit is contained in:
15
inertia/contexts/active_collection_context.tsx
Normal file
15
inertia/contexts/active_collection_context.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
import type Collection from '#models/collection';
|
||||
import { createContext } from 'react';
|
||||
|
||||
type ActiveCollectionContextType = {
|
||||
activeCollection: Collection | null;
|
||||
setActiveCollection: (collection: Collection) => void;
|
||||
};
|
||||
|
||||
const iActiveCollectionContextState: ActiveCollectionContextType = {
|
||||
activeCollection: null,
|
||||
setActiveCollection: (_: Collection) => {},
|
||||
};
|
||||
|
||||
export const ActiveCollectionContext =
|
||||
createContext<ActiveCollectionContextType>(iActiveCollectionContextState);
|
||||
18
inertia/contexts/collections_context.ts
Normal file
18
inertia/contexts/collections_context.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import Collection from '#models/collection';
|
||||
import { createContext } from 'react';
|
||||
|
||||
type CollectionsContextType = {
|
||||
collections: Collection[];
|
||||
setCollections: (collections: Collection[]) => void | Collection[];
|
||||
};
|
||||
|
||||
const iCollectionsContextState: CollectionsContextType = {
|
||||
collections: [] as Collection[],
|
||||
setCollections: (_: Collection[]) => {},
|
||||
};
|
||||
|
||||
const CollectionsContext = createContext<CollectionsContextType>(
|
||||
iCollectionsContextState
|
||||
);
|
||||
|
||||
export default CollectionsContext;
|
||||
16
inertia/contexts/favorites_context.ts
Normal file
16
inertia/contexts/favorites_context.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import type Link from '#models/link';
|
||||
import { createContext } from 'react';
|
||||
|
||||
type FavoritesContextType = {
|
||||
favorites: Link[];
|
||||
};
|
||||
|
||||
const iFavoritesContextState = {
|
||||
favorites: [] as Link[],
|
||||
};
|
||||
|
||||
const FavoritesContext = createContext<FavoritesContextType>(
|
||||
iFavoritesContextState
|
||||
);
|
||||
|
||||
export default FavoritesContext;
|
||||
17
inertia/contexts/global_hotkeys_context.ts
Normal file
17
inertia/contexts/global_hotkeys_context.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { createContext } from 'react';
|
||||
|
||||
type GlobalHotkeysContext = {
|
||||
globalHotkeysEnabled: boolean;
|
||||
setGlobalHotkeysEnabled: (value: boolean) => void;
|
||||
};
|
||||
|
||||
const iGlobalHotkeysContextState = {
|
||||
globalHotkeysEnabled: true,
|
||||
setGlobalHotkeysEnabled: (_: boolean) => {},
|
||||
};
|
||||
|
||||
const GlobalHotkeysContext = createContext<GlobalHotkeysContext>(
|
||||
iGlobalHotkeysContextState
|
||||
);
|
||||
|
||||
export default GlobalHotkeysContext;
|
||||
Reference in New Issue
Block a user