refactor progress

This commit is contained in:
Hampus Kraft
2026-02-17 12:22:36 +00:00
parent cb31608523
commit d5abd1a7e4
8257 changed files with 1190207 additions and 761040 deletions

View File

@@ -17,8 +17,8 @@
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
*/
import React from 'react';
import type {GuildSplashCardAlignmentValue} from '~/Constants';
import type {GuildSplashCardAlignmentValue} from '@fluxer/constants/src/GuildConstants';
import React, {useContext} from 'react';
interface AuthLayoutContextType {
setSplashUrl: (url: string | null) => void;
@@ -29,7 +29,7 @@ interface AuthLayoutContextType {
export const AuthLayoutContext = React.createContext<AuthLayoutContextType | null>(null);
export const useAuthLayoutContext = () => {
const context = React.useContext(AuthLayoutContext);
const context = useContext(AuthLayoutContext);
if (!context) {
throw new Error('useAuthLayoutContext must be used within AuthLayoutProvider');
}

View File

@@ -0,0 +1,52 @@
/*
* Copyright (C) 2026 Fluxer Contributors
*
* This file is part of Fluxer.
*
* Fluxer is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Fluxer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
*/
import React, {useContext} from 'react';
export interface AuthRegisterFormDraft {
formValues: Record<string, string>;
selectedMonth: string;
selectedDay: string;
selectedYear: string;
consent: boolean;
}
export const EMPTY_AUTH_REGISTER_FORM_DRAFT: AuthRegisterFormDraft = {
formValues: {},
selectedMonth: '',
selectedDay: '',
selectedYear: '',
consent: false,
};
interface AuthRegisterDraftContextType {
getRegisterFormDraft: (draftKey: string) => AuthRegisterFormDraft | undefined;
setRegisterFormDraft: (draftKey: string, draft: AuthRegisterFormDraft) => void;
clearRegisterFormDraft: (draftKey: string) => void;
}
export const AuthRegisterDraftContext = React.createContext<AuthRegisterDraftContextType | null>(null);
export function useAuthRegisterDraftContext(): AuthRegisterDraftContextType {
const context = useContext(AuthRegisterDraftContext);
if (!context) {
throw new Error('useAuthRegisterDraftContext must be used within AuthLayout');
}
return context;
}

View File

@@ -1,44 +0,0 @@
/*
* Copyright (C) 2026 Fluxer Contributors
*
* This file is part of Fluxer.
*
* Fluxer is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Fluxer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
*/
import type React from 'react';
import {createContext, useContext} from 'react';
export interface ChannelListScrollbarContextValue {
hasScrollbar: boolean;
}
export const ChannelListScrollbarContext = createContext<ChannelListScrollbarContextValue | null>(null);
export const useChannelListScrollbar = (): ChannelListScrollbarContextValue => {
const context = useContext(ChannelListScrollbarContext);
if (!context) {
throw new Error('useChannelListScrollbar must be used within a ChannelListScrollbarProvider');
}
return context;
};
interface ChannelListScrollbarProviderProps {
children: React.ReactNode;
value: ChannelListScrollbarContextValue;
}
export const ChannelListScrollbarProvider: React.FC<ChannelListScrollbarProviderProps> = ({children, value}) => {
return <ChannelListScrollbarContext.Provider value={value}>{children}</ChannelListScrollbarContext.Provider>;
};

View File

@@ -17,9 +17,9 @@
* along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
*/
import React from 'react';
import React, {useContext} from 'react';
export type LayoutVariant = 'app' | 'auth';
export type LayoutVariant = 'app' | 'auth' | 'call';
interface LayoutVariantContextValue {
variant: LayoutVariant;
@@ -35,6 +35,6 @@ const LayoutVariantContext = React.createContext<LayoutVariantContextValue>(defa
export const LayoutVariantProvider = LayoutVariantContext.Provider;
export const useLayoutVariant = () => React.useContext(LayoutVariantContext).variant;
export const useLayoutVariant = () => useContext(LayoutVariantContext).variant;
export const useSetLayoutVariant = () => React.useContext(LayoutVariantContext).setVariant;
export const useSetLayoutVariant = () => useContext(LayoutVariantContext).setVariant;