JUMBO refactor, still work in progress

This commit is contained in:
2025-10-07 00:14:31 +02:00
parent 3694492e1a
commit dc0ec5c635
50 changed files with 4283 additions and 3698 deletions

View File

@@ -1,4 +1,4 @@
import { UserId } from "common";
import { type Me } from "common/the_api";
import { identity } from "effect";
import { useLayoutEffect, useState } from "react";
@@ -9,23 +9,15 @@ export const mapProp = <const K extends string, T>(prop: K, action: Update<T>) =
return Object.freeze({ ...object, [prop]: typeof action === "function" ? (action as (prev: T) => T)(object[prop]) : action });
};
export namespace Store {
export interface User {
readonly userId: UserId;
readonly username: string;
readonly roles: readonly string[];
}
}
export interface Store {
readonly user: Store.User | null;
readonly user: Me | null;
}
let store: Store = Object.freeze<Store>({
user: null,
});
export function setUser(action: Update<Store.User | null>) {
export function setUser(action: Update<Me | null>) {
set(mapProp("user", action));
}