chore: move all settings to dashboard
This commit is contained in:
parent
563d313dae
commit
ab0923d06d
@ -9,7 +9,7 @@ export interface ModalProps {
|
|||||||
bodyClassName?: string;
|
bodyClassName?: string;
|
||||||
onClose?: (e: React.MouseEvent | KeyboardEvent) => void;
|
onClose?: (e: React.MouseEvent | KeyboardEvent) => void;
|
||||||
onClick?: (e: React.MouseEvent) => void;
|
onClick?: (e: React.MouseEvent) => void;
|
||||||
children: ReactNode;
|
children?: ReactNode;
|
||||||
showClose?: boolean;
|
showClose?: boolean;
|
||||||
ready?: boolean;
|
ready?: boolean;
|
||||||
largeModal?: boolean;
|
largeModal?: boolean;
|
||||||
|
@ -90,13 +90,13 @@ interface NewStreamDialogProps {
|
|||||||
btnClassName?: string;
|
btnClassName?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function NewStreamDialog(props: NewStreamDialogProps & StreamEditorProps) {
|
export function NewStreamDialog({ text, btnClassName, ...props }: NewStreamDialogProps & StreamEditorProps) {
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DefaultButton className={props.btnClassName} onClick={() => setOpen(true)}>
|
<DefaultButton className={btnClassName} onClick={() => setOpen(true)}>
|
||||||
{props.text && props.text}
|
{text && text}
|
||||||
{!props.text && (
|
{!text && (
|
||||||
<>
|
<>
|
||||||
<span className="max-xl:hidden">
|
<span className="max-xl:hidden">
|
||||||
<FormattedMessage defaultMessage="Stream" id="uYw2LD" />
|
<FormattedMessage defaultMessage="Stream" id="uYw2LD" />
|
||||||
|
@ -134,10 +134,6 @@ const router = createBrowserRouter([
|
|||||||
path: "",
|
path: "",
|
||||||
element: <AccountSettingsTab />,
|
element: <AccountSettingsTab />,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: "stream",
|
|
||||||
element: <StreamSettingsTab />,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
path: "profile",
|
path: "profile",
|
||||||
element: <ProfileSettings />,
|
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 ManualStream from "./manual-stream";
|
||||||
import { unixNow } from "@snort/shared";
|
import { unixNow } from "@snort/shared";
|
||||||
import { Icon } from "@/element/icon";
|
import { Icon } from "@/element/icon";
|
||||||
|
import ForwardingModal from "./forwarding";
|
||||||
|
import BalanceHistoryModal from "./balance-history";
|
||||||
const StreamSummary = lazy(() => import("@/element/summary-chart"));
|
const StreamSummary = lazy(() => import("@/element/summary-chart"));
|
||||||
|
|
||||||
export function DashboardForLink({ link }: { link: NostrLink }) {
|
export function DashboardForLink({ link }: { link: NostrLink }) {
|
||||||
@ -220,6 +222,17 @@ export function DashboardForLink({ link }: { link: NostrLink }) {
|
|||||||
</div>
|
</div>
|
||||||
</DashboardCard>
|
</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>
|
</div>
|
||||||
{streamLink && status === StreamState.Live && (
|
{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" />,
|
name: <FormattedMessage defaultMessage="Profile" />,
|
||||||
path: "profile",
|
path: "profile",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: <FormattedMessage defaultMessage="Stream" />,
|
|
||||||
path: "stream",
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
export default function SettingsPage() {
|
export default function SettingsPage() {
|
||||||
const naviage = useNavigate();
|
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