mirror of
https://github.com/rowyio/rowy.git
synced 2025-12-29 00:16:39 +01:00
move types in src/atoms/projectScope to src/types/settings
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
import { atom } from "jotai";
|
||||
import { sortBy } from "lodash-es";
|
||||
import { ThemeOptions } from "@mui/material";
|
||||
|
||||
import { userRolesAtom } from "./auth";
|
||||
import { UserSettings } from "./user";
|
||||
import {
|
||||
PublicSettings,
|
||||
ProjectSettings,
|
||||
UserSettings,
|
||||
} from "@src/types/settings";
|
||||
import {
|
||||
UpdateDocFunction,
|
||||
UpdateCollectionDocFunction,
|
||||
@@ -15,22 +18,6 @@ import { FunctionSettings } from "@src/types/function";
|
||||
|
||||
export const projectIdAtom = atom<string>("");
|
||||
|
||||
/** Public settings are visible to unauthenticated users */
|
||||
export type PublicSettings = Partial<{
|
||||
signInOptions: Array<
|
||||
| "google"
|
||||
| "twitter"
|
||||
| "facebook"
|
||||
| "github"
|
||||
| "microsoft"
|
||||
| "apple"
|
||||
| "yahoo"
|
||||
| "email"
|
||||
| "phone"
|
||||
| "anonymous"
|
||||
>;
|
||||
theme: Record<"base" | "light" | "dark", ThemeOptions>;
|
||||
}>;
|
||||
/** Public settings are visible to unauthenticated users */
|
||||
export const publicSettingsAtom = atom<PublicSettings>({});
|
||||
/** Stores a function that updates public settings */
|
||||
@@ -38,21 +25,6 @@ export const updatePublicSettingsAtom = atom<
|
||||
UpdateDocFunction<PublicSettings> | undefined
|
||||
>(undefined);
|
||||
|
||||
/** Project settings are visible to authenticated users */
|
||||
export type ProjectSettings = Partial<{
|
||||
tables: TableSettings[];
|
||||
|
||||
setupCompleted: boolean;
|
||||
|
||||
rowyRunUrl: string;
|
||||
rowyRunRegion: string;
|
||||
rowyRunDeployStatus: "BUILDING" | "COMPLETE";
|
||||
services: Partial<{
|
||||
hooks: string;
|
||||
builder: string;
|
||||
terminal: string;
|
||||
}>;
|
||||
}>;
|
||||
/** Project settings are visible to authenticated users */
|
||||
export const projectSettingsAtom = atom<ProjectSettings>({});
|
||||
/**
|
||||
|
||||
@@ -1,45 +1,12 @@
|
||||
import { atom } from "jotai";
|
||||
import { atomWithStorage } from "jotai/utils";
|
||||
import { merge } from "lodash-es";
|
||||
import { ThemeOptions } from "@mui/material";
|
||||
|
||||
import themes from "@src/theme";
|
||||
import { publicSettingsAtom } from "./project";
|
||||
import {
|
||||
UpdateDocFunction,
|
||||
TableFilter,
|
||||
TableRowRef,
|
||||
TableSort,
|
||||
} from "@src/types/table";
|
||||
import { UserSettings } from "@src/types/settings";
|
||||
import { UpdateDocFunction } from "@src/types/table";
|
||||
|
||||
/** User info and settings */
|
||||
export type UserSettings = Partial<{
|
||||
_rowy_ref: TableRowRef;
|
||||
/** Synced from user auth info */
|
||||
user: {
|
||||
email: string;
|
||||
displayName?: string;
|
||||
photoURL?: string;
|
||||
phoneNumber?: string;
|
||||
};
|
||||
roles: string[];
|
||||
|
||||
theme: Record<"base" | "light" | "dark", ThemeOptions>;
|
||||
|
||||
favoriteTables: string[];
|
||||
/** Stores user overrides */
|
||||
tables: Record<
|
||||
string,
|
||||
Partial<{
|
||||
filters: TableFilter[];
|
||||
hiddenFields: string[];
|
||||
sorts: TableSort[];
|
||||
}>
|
||||
>;
|
||||
|
||||
/** Stores table tutorial completion */
|
||||
tableTutorialComplete?: boolean;
|
||||
}>;
|
||||
/** User info and settings */
|
||||
export const userSettingsAtom = atom<UserSettings>({});
|
||||
/** Stores a function that updates user settings */
|
||||
|
||||
@@ -23,12 +23,12 @@ import {
|
||||
projectSettingsAtom,
|
||||
rowyRunAtom,
|
||||
rowyRunModalAtom,
|
||||
UserSettings,
|
||||
updateUserAtom,
|
||||
confirmDialogAtom,
|
||||
} from "@src/atoms/projectScope";
|
||||
import { runRoutes } from "@src/constants/runRoutes";
|
||||
import { USERS } from "@src/config/dbPaths";
|
||||
import type { UserSettings } from "@src/types/settings";
|
||||
|
||||
export default function UserItem({
|
||||
_rowy_ref,
|
||||
|
||||
64
src/types/settings.d.ts
vendored
Normal file
64
src/types/settings.d.ts
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
import { ThemeOptions } from "@mui/material";
|
||||
import { TableSettings, TableFilter, TableRowRef, TableSort } from "./table";
|
||||
|
||||
/** Public settings are visible to unauthenticated users */
|
||||
export type PublicSettings = Partial<{
|
||||
signInOptions: Array<
|
||||
| "google"
|
||||
| "twitter"
|
||||
| "facebook"
|
||||
| "github"
|
||||
| "microsoft"
|
||||
| "apple"
|
||||
| "yahoo"
|
||||
| "email"
|
||||
| "phone"
|
||||
| "anonymous"
|
||||
>;
|
||||
theme: Record<"base" | "light" | "dark", ThemeOptions>;
|
||||
}>;
|
||||
|
||||
/** Project settings are visible to authenticated users */
|
||||
export type ProjectSettings = Partial<{
|
||||
tables: TableSettings[];
|
||||
|
||||
setupCompleted: boolean;
|
||||
|
||||
rowyRunUrl: string;
|
||||
rowyRunRegion: string;
|
||||
rowyRunDeployStatus: "BUILDING" | "COMPLETE";
|
||||
services: Partial<{
|
||||
hooks: string;
|
||||
builder: string;
|
||||
terminal: string;
|
||||
}>;
|
||||
}>;
|
||||
|
||||
/** User info and settings */
|
||||
export type UserSettings = Partial<{
|
||||
_rowy_ref: TableRowRef;
|
||||
/** Synced from user auth info */
|
||||
user: {
|
||||
email: string;
|
||||
displayName?: string;
|
||||
photoURL?: string;
|
||||
phoneNumber?: string;
|
||||
};
|
||||
roles: string[];
|
||||
|
||||
theme: Record<"base" | "light" | "dark", ThemeOptions>;
|
||||
|
||||
favoriteTables: string[];
|
||||
/** Stores user overrides */
|
||||
tables: Record<
|
||||
string,
|
||||
Partial<{
|
||||
filters: TableFilter[];
|
||||
hiddenFields: string[];
|
||||
sorts: TableSort[];
|
||||
}>
|
||||
>;
|
||||
|
||||
/** Stores table tutorial completion */
|
||||
tableTutorialComplete?: boolean;
|
||||
}>;
|
||||
Reference in New Issue
Block a user