refactor: login page

This commit is contained in:
Fredrik Burmester
2026-01-31 10:52:21 +01:00
parent 6e85c8d54a
commit 85a74a9a6a
27 changed files with 2422 additions and 1236 deletions

View File

@@ -0,0 +1,34 @@
import { useCallback } from "react";
import useRouter from "@/hooks/useAppRouter";
import { tvAccountActionModalAtom } from "@/utils/atoms/tvAccountActionModal";
import type {
SavedServer,
SavedServerAccount,
} from "@/utils/secureCredentials";
import { store } from "@/utils/store";
interface ShowAccountActionModalParams {
server: SavedServer;
account: SavedServerAccount;
onLogin: () => void;
onDelete: () => void;
}
export const useTVAccountActionModal = () => {
const router = useRouter();
const showAccountActionModal = useCallback(
(params: ShowAccountActionModalParams) => {
store.set(tvAccountActionModalAtom, {
server: params.server,
account: params.account,
onLogin: params.onLogin,
onDelete: params.onDelete,
});
router.push("/tv-account-action-modal");
},
[router],
);
return { showAccountActionModal };
};

View File

@@ -9,9 +9,9 @@ import { store } from "@/utils/store";
interface ShowAccountSelectModalParams {
server: SavedServer;
onAccountSelect: (account: SavedServerAccount) => void;
onAccountAction: (account: SavedServerAccount) => void;
onAddAccount: () => void;
onDeleteAccount: (account: SavedServerAccount) => void;
onDeleteServer: () => void;
}
export const useTVAccountSelectModal = () => {
@@ -21,9 +21,9 @@ export const useTVAccountSelectModal = () => {
(params: ShowAccountSelectModalParams) => {
store.set(tvAccountSelectModalAtom, {
server: params.server,
onAccountSelect: params.onAccountSelect,
onAccountAction: params.onAccountAction,
onAddAccount: params.onAddAccount,
onDeleteAccount: params.onDeleteAccount,
onDeleteServer: params.onDeleteServer,
});
router.push("/tv-account-select-modal");
},

View File

@@ -1,29 +0,0 @@
import { useCallback } from "react";
import useRouter from "@/hooks/useAppRouter";
import { tvServerActionModalAtom } from "@/utils/atoms/tvServerActionModal";
import type { SavedServer } from "@/utils/secureCredentials";
import { store } from "@/utils/store";
interface ShowServerActionModalParams {
server: SavedServer;
onLogin: () => void;
onDelete: () => void;
}
export const useTVServerActionModal = () => {
const router = useRouter();
const showServerActionModal = useCallback(
(params: ShowServerActionModalParams) => {
store.set(tvServerActionModalAtom, {
server: params.server,
onLogin: params.onLogin,
onDelete: params.onDelete,
});
router.push("/tv-server-action-modal");
},
[router],
);
return { showServerActionModal };
};