wip
This commit is contained in:
@@ -9,6 +9,7 @@ export interface RasterSource {
|
||||
tileSize: number;
|
||||
}
|
||||
|
||||
|
||||
interface ErrorState {
|
||||
field: string;
|
||||
message: string;
|
||||
@@ -19,7 +20,12 @@ interface ErrorState {
|
||||
message: string;
|
||||
}
|
||||
|
||||
interface AppState {
|
||||
export interface App {
|
||||
unreadCounts: Map<number, number>;
|
||||
setUnread: (id: number, count: number) => void;
|
||||
}
|
||||
|
||||
export interface AppState {
|
||||
selectedDevice: number;
|
||||
devices: {
|
||||
id: number;
|
||||
@@ -34,6 +40,7 @@ interface AppState {
|
||||
activeChat: number;
|
||||
chatType: "broadcast" | "direct";
|
||||
errors: ErrorState[];
|
||||
unreadCounts: Map<number, number>;
|
||||
|
||||
setRasterSources: (sources: RasterSource[]) => void;
|
||||
addRasterSource: (source: RasterSource) => void;
|
||||
@@ -56,6 +63,9 @@ interface AppState {
|
||||
removeError: (field: string) => void;
|
||||
clearErrors: () => void;
|
||||
setNewErrors: (newErrors: ErrorState[]) => void;
|
||||
|
||||
// unread counts
|
||||
setUnread: (id: number, count: number) => void;
|
||||
}
|
||||
|
||||
export const useAppStore = create<AppState>()((set, get) => ({
|
||||
@@ -70,6 +80,7 @@ export const useAppStore = create<AppState>()((set, get) => ({
|
||||
activeChat: Types.ChannelNumber.Primary,
|
||||
chatType: "broadcast",
|
||||
errors: [],
|
||||
unreadCounts: new Map([[0, 100],[2718471552, 1]]),
|
||||
|
||||
setRasterSources: (sources: RasterSource[]) => {
|
||||
set(
|
||||
@@ -178,4 +189,11 @@ export const useAppStore = create<AppState>()((set, get) => ({
|
||||
}),
|
||||
);
|
||||
},
|
||||
setUnread: (id: number, count: number) => {
|
||||
set(
|
||||
produce<AppState>((draft) => {
|
||||
draft.unreadCounts.set(id, count);
|
||||
})
|
||||
);
|
||||
}
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user