From c194fff7fd131af238d603a3c7a7a1d6dea66644 Mon Sep 17 00:00:00 2001 From: bree <me@bree.dev> Date: Sun, 4 Jul 2021 21:22:33 -0400 Subject: [PATCH] Resolve remaining review notes --- src/components/ui/Category.tsx | 1 - src/context/Theme.tsx | 15 ++++++++++----- src/context/Voice.tsx | 3 +-- src/context/intermediate/modals/Input.tsx | 3 +-- src/context/revoltjs/RevoltClient.tsx | 6 ++++-- 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/components/ui/Category.tsx b/src/components/ui/Category.tsx index 38980b1..3f76d28 100644 --- a/src/components/ui/Category.tsx +++ b/src/components/ui/Category.tsx @@ -33,7 +33,6 @@ const CategoryBase = styled.div<Pick<Props, 'variant'>>` type Props = Omit<JSX.HTMLAttributes<HTMLDivElement>, 'children' | 'as' | 'action'> & { text: Children; - // TODO: rename from action to prevent type conflicts with the dom action?: () => void; variant?: 'default' | 'uniform'; } diff --git a/src/context/Theme.tsx b/src/context/Theme.tsx index a676478..065d695 100644 --- a/src/context/Theme.tsx +++ b/src/context/Theme.tsx @@ -31,7 +31,14 @@ export type Variables = | "status-busy" | "status-streaming" | "status-invisible" - | "sidebar-active"; + +// While this isn't used, it'd be good to keep this up to date as a reference or for future use +export type HiddenVariables = + | "font" + | "ligatures" + | "app-height" + | "sidebar-active" + | "monospace-font" export type Fonts = 'Open Sans' | 'Inter' | 'Atkinson Hyperlegible' | 'Roboto' | 'Noto Sans' | 'Lato' | 'Bree Serif' | 'Montserrat' | 'Poppins' | 'Raleway' | 'Ubuntu' | 'Comic Neue'; export type MonoscapeFonts = 'Fira Code' | 'Roboto Mono' | 'Source Code Pro' | 'Space Mono' | 'Ubuntu Mono'; @@ -215,8 +222,7 @@ export const PRESETS: Record<string, Theme> = { "status-away": "#F39F00", "status-busy": "#F84848", "status-streaming": "#977EFF", - "status-invisible": "#A5A5A5", - "sidebar-active": "var(--secondary-background)" + "status-invisible": "#A5A5A5" }, dark: { light: false, @@ -243,8 +249,7 @@ export const PRESETS: Record<string, Theme> = { "status-away": "#F39F00", "status-busy": "#F84848", "status-streaming": "#977EFF", - "status-invisible": "#A5A5A5", - "sidebar-active": "var(--secondary-background)" + "status-invisible": "#A5A5A5" }, }; diff --git a/src/context/Voice.tsx b/src/context/Voice.tsx index 2f6fedf..6190c36 100644 --- a/src/context/Voice.tsx +++ b/src/context/Voice.tsx @@ -33,8 +33,7 @@ export interface VoiceState { participants?: Readonly<Map<string, VoiceUser>>; } -// [bree] TODO: I feel like these should be typechecked anyways but whatever, -// I'm asserting that they aren't null because they get used near immedietly from what I can tell +// They should be present from first render. - insert's words export const VoiceContext = createContext<VoiceState>(null!); export const VoiceOperationsContext = createContext<VoiceOperations>(null!); diff --git a/src/context/intermediate/modals/Input.tsx b/src/context/intermediate/modals/Input.tsx index ec4c9de..d57ba8d 100644 --- a/src/context/intermediate/modals/Input.tsx +++ b/src/context/intermediate/modals/Input.tsx @@ -119,9 +119,8 @@ export function SpecialInputModal(props: SpecialProps) { question={<Text id="app.settings.permissions.create_role" />} field={<Text id="app.settings.permissions.role_name" />} callback={async name => { - // bree: this returns void, dunno why props.callback was being called const role = await client.servers.createRole(props.server, name); - // props.callback(role.id); + props.callback(role.id); }} />; } diff --git a/src/context/revoltjs/RevoltClient.tsx b/src/context/revoltjs/RevoltClient.tsx index 99ad0eb..a975c10 100644 --- a/src/context/revoltjs/RevoltClient.tsx +++ b/src/context/revoltjs/RevoltClient.tsx @@ -34,7 +34,9 @@ export interface ClientOperations { openDM: (user_id: string) => Promise<string>; } -// TODO: remove temporary non-null assertions and properly typecheck these as they aren't always immedietely initialized +// By the time they are used, they should all be initialized. +// Currently the app does not render until a client is built and the other two are always initialized on first render. +// - insert's words export const AppContext = createContext<Client>(null!); export const StatusContext = createContext<ClientStatus>(null!); export const OperationsContext = createContext<ClientOperations>(null!); @@ -94,7 +96,7 @@ function Context({ auth, children, dispatcher }: Props) { const login = () => dispatcher({ type: "LOGIN", - session: client.session! // TODO: verify that this null assertion is correct + session: client.session! // This [null assertion] is ok, we should have a session by now. - insert's words }); if (onboarding) { -- GitLab