chore: move all settings to dashboard
This commit is contained in:
parent
563d313dae
commit
ab0923d06d
@ -9,7 +9,7 @@ export interface ModalProps {
|
||||
bodyClassName?: string;
|
||||
onClose?: (e: React.MouseEvent | KeyboardEvent) => void;
|
||||
onClick?: (e: React.MouseEvent) => void;
|
||||
children: ReactNode;
|
||||
children?: ReactNode;
|
||||
showClose?: boolean;
|
||||
ready?: boolean;
|
||||
largeModal?: boolean;
|
||||
|
@ -90,13 +90,13 @@ interface NewStreamDialogProps {
|
||||
btnClassName?: string;
|
||||
}
|
||||
|
||||
export function NewStreamDialog(props: NewStreamDialogProps & StreamEditorProps) {
|
||||
export function NewStreamDialog({ text, btnClassName, ...props }: NewStreamDialogProps & StreamEditorProps) {
|
||||
const [open, setOpen] = useState(false);
|
||||
return (
|
||||
<>
|
||||
<DefaultButton className={props.btnClassName} onClick={() => setOpen(true)}>
|
||||
{props.text && props.text}
|
||||
{!props.text && (
|
||||
<DefaultButton className={btnClassName} onClick={() => setOpen(true)}>
|
||||
{text && text}
|
||||
{!text && (
|
||||
<>
|
||||
<span className="max-xl:hidden">
|
||||
<FormattedMessage defaultMessage="Stream" id="uYw2LD" />
|
||||
|
@ -134,10 +134,6 @@ const router = createBrowserRouter([
|
||||
path: "",
|
||||
element: <AccountSettingsTab />,
|
||||
},
|
||||
{
|
||||
path: "stream",
|
||||
element: <StreamSettingsTab />,
|
||||
},
|
||||
{
|
||||
path: "profile",
|
||||
element: <ProfileSettings />,
|
||||
|
28
src/pages/dashboard/balance-history.tsx
Normal file
28
src/pages/dashboard/balance-history.tsx
Normal file
@ -0,0 +1,28 @@
|
||||
import { DefaultButton } from "@/element/buttons";
|
||||
import Modal from "@/element/modal";
|
||||
import { useState } from "react";
|
||||
import { FormattedMessage } from "react-intl";
|
||||
import { NostrStreamProvider } from "@/providers";
|
||||
import NostrProviderDialog from "@/element/provider/nostr";
|
||||
|
||||
export default function BalanceHistoryModal({ provider }: { provider: NostrStreamProvider }) {
|
||||
const [show, setShow] = useState(false);
|
||||
return (
|
||||
<>
|
||||
<DefaultButton onClick={() => setShow(true)}>
|
||||
<FormattedMessage defaultMessage="Balance" />
|
||||
</DefaultButton>
|
||||
{show && (
|
||||
<Modal id="raid-menu" onClose={() => setShow(false)} largeModal={true}>
|
||||
<NostrProviderDialog
|
||||
provider={provider}
|
||||
showBalanceHistory={true}
|
||||
showEditor={false}
|
||||
showEndpoints={true}
|
||||
showForwards={false}
|
||||
/>
|
||||
</Modal>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
@ -28,6 +28,8 @@ import classNames from "classnames";
|
||||
import ManualStream from "./manual-stream";
|
||||
import { unixNow } from "@snort/shared";
|
||||
import { Icon } from "@/element/icon";
|
||||
import ForwardingModal from "./forwarding";
|
||||
import BalanceHistoryModal from "./balance-history";
|
||||
const StreamSummary = lazy(() => import("@/element/summary-chart"));
|
||||
|
||||
export function DashboardForLink({ link }: { link: NostrLink }) {
|
||||
@ -220,6 +222,17 @@ export function DashboardForLink({ link }: { link: NostrLink }) {
|
||||
</div>
|
||||
</DashboardCard>
|
||||
)}
|
||||
{(!streamLink || status === StreamState.Ended) && (
|
||||
<DashboardCard className="flex flex-col gap-4">
|
||||
<h3>
|
||||
<FormattedMessage defaultMessage="Account Setup" />
|
||||
</h3>
|
||||
<div className="flex gap-2">
|
||||
<BalanceHistoryModal provider={provider} />
|
||||
<ForwardingModal provider={provider} />
|
||||
</div>
|
||||
</DashboardCard>
|
||||
)}
|
||||
</div>
|
||||
{streamLink && status === StreamState.Live && (
|
||||
<>
|
||||
|
28
src/pages/dashboard/forwarding.tsx
Normal file
28
src/pages/dashboard/forwarding.tsx
Normal file
@ -0,0 +1,28 @@
|
||||
import { DefaultButton } from "@/element/buttons";
|
||||
import Modal from "@/element/modal";
|
||||
import { useState } from "react";
|
||||
import { FormattedMessage } from "react-intl";
|
||||
import { NostrStreamProvider } from "@/providers";
|
||||
import NostrProviderDialog from "@/element/provider/nostr";
|
||||
|
||||
export default function ForwardingModal({ provider }: { provider: NostrStreamProvider }) {
|
||||
const [show, setShow] = useState(false);
|
||||
return (
|
||||
<>
|
||||
<DefaultButton onClick={() => setShow(true)}>
|
||||
<FormattedMessage defaultMessage="Stream Forwarding" />
|
||||
</DefaultButton>
|
||||
{show && (
|
||||
<Modal id="raid-menu" onClose={() => setShow(false)}>
|
||||
<NostrProviderDialog
|
||||
provider={provider}
|
||||
showBalanceHistory={false}
|
||||
showEditor={false}
|
||||
showEndpoints={false}
|
||||
showForwards={true}
|
||||
/>
|
||||
</Modal>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
@ -11,10 +11,6 @@ const Tabs = [
|
||||
name: <FormattedMessage defaultMessage="Profile" />,
|
||||
path: "profile",
|
||||
},
|
||||
{
|
||||
name: <FormattedMessage defaultMessage="Stream" />,
|
||||
path: "stream",
|
||||
},
|
||||
];
|
||||
export default function SettingsPage() {
|
||||
const naviage = useNavigate();
|
||||
|
@ -1,25 +0,0 @@
|
||||
import NostrProviderDialog from "@/element/provider/nostr";
|
||||
import { useStreamProvider } from "@/hooks/stream-provider";
|
||||
import { NostrStreamProvider } from "@/providers";
|
||||
import { unwrap } from "@snort/shared";
|
||||
import { FormattedMessage } from "react-intl";
|
||||
|
||||
export function StreamSettingsTab() {
|
||||
const providers = useStreamProvider();
|
||||
return (
|
||||
<>
|
||||
<h1>
|
||||
<FormattedMessage defaultMessage="Stream" id="uYw2LD" />
|
||||
</h1>
|
||||
<div className="flex flex-col gap-4">
|
||||
<NostrProviderDialog
|
||||
provider={unwrap(providers.find(a => a.name === "zap.stream")) as NostrStreamProvider}
|
||||
showEndpoints={true}
|
||||
showEditor={false}
|
||||
showForwards={true}
|
||||
showBalanceHistory={true}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user