feat: enable recording checkbox
This commit is contained in:
@ -153,7 +153,7 @@ const router = createBrowserRouter([
|
|||||||
element: <StreamSummaryPage />,
|
element: <StreamSummaryPage />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/dashboard",
|
path: "/dashboard/:id?",
|
||||||
element: (
|
element: (
|
||||||
<Suspense>
|
<Suspense>
|
||||||
<DashboardPage />
|
<DashboardPage />
|
||||||
|
@ -393,6 +393,9 @@
|
|||||||
"My6HwN": {
|
"My6HwN": {
|
||||||
"defaultMessage": "Ok, it's safe"
|
"defaultMessage": "Ok, it's safe"
|
||||||
},
|
},
|
||||||
|
"NTpJIm": {
|
||||||
|
"defaultMessage": "Enable Recording"
|
||||||
|
},
|
||||||
"NnHu0L": {
|
"NnHu0L": {
|
||||||
"defaultMessage": "Please upload at least 1 video"
|
"defaultMessage": "Please upload at least 1 video"
|
||||||
},
|
},
|
||||||
|
@ -39,11 +39,16 @@ export function DashboardForLink({ link }: { link: NostrLink }) {
|
|||||||
const [info, setInfo] = useState<StreamProviderInfo>();
|
const [info, setInfo] = useState<StreamProviderInfo>();
|
||||||
const isMyManual = streamEvent?.pubkey === login?.pubkey;
|
const isMyManual = streamEvent?.pubkey === login?.pubkey;
|
||||||
const system = useContext(SnortContext);
|
const system = useContext(SnortContext);
|
||||||
|
const [recording, setRecording] = useState(Boolean(localStorage.getItem("default-recording") ?? "true"));
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
localStorage.setItem("default-recording", String(recording));
|
||||||
|
}, [recording]);
|
||||||
|
|
||||||
const provider = useMemo(() => (service ? new NostrStreamProvider("", service) : DefaultProvider), [service]);
|
const provider = useMemo(() => (service ? new NostrStreamProvider("", service) : DefaultProvider), [service]);
|
||||||
const defaultEndpoint = useMemo(() => {
|
const defaultEndpoint = useMemo(() => {
|
||||||
return info?.endpoints.find(a => a.name == "Good");
|
return info?.endpoints.find(a => a.name == (recording ? "Best" : "Good"));
|
||||||
}, [info]);
|
}, [info, recording]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isMyManual) {
|
if (!isMyManual) {
|
||||||
@ -195,6 +200,10 @@ export function DashboardForLink({ link }: { link: NostrLink }) {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</p>
|
</p>
|
||||||
|
<div className="flex gap-4 items-center">
|
||||||
|
<input type="checkbox" checked={recording} onChange={e => setRecording(e.target.checked)} />
|
||||||
|
<FormattedMessage defaultMessage="Enable Recording" />
|
||||||
|
</div>
|
||||||
{defaultEndpoint && <StreamKey ep={defaultEndpoint} />}
|
{defaultEndpoint && <StreamKey ep={defaultEndpoint} />}
|
||||||
<ManualStream />
|
<ManualStream />
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
import { useLogin } from "@/hooks/login";
|
import { useLogin } from "@/hooks/login";
|
||||||
import { NostrLink, NostrPrefix } from "@snort/system";
|
import { NostrLink, NostrPrefix, parseNostrLink } from "@snort/system";
|
||||||
import { DashboardForLink } from "./dashboard";
|
import { DashboardForLink } from "./dashboard";
|
||||||
|
import { useParams } from "react-router-dom";
|
||||||
|
|
||||||
export default function DashboardPage() {
|
export default function DashboardPage() {
|
||||||
const login = useLogin();
|
const login = useLogin();
|
||||||
|
const { id } = useParams();
|
||||||
if (!login) return;
|
if (!login) return;
|
||||||
|
const link = id ? parseNostrLink(id) : new NostrLink(NostrPrefix.PublicKey, login.pubkey);
|
||||||
|
|
||||||
return <DashboardForLink link={new NostrLink(NostrPrefix.PublicKey, login.pubkey)} />;
|
return <DashboardForLink link={link} />;
|
||||||
}
|
}
|
||||||
|
@ -130,6 +130,7 @@
|
|||||||
"LxSJOb": "Go to Dashboard",
|
"LxSJOb": "Go to Dashboard",
|
||||||
"MTHO1W": "Start Raid",
|
"MTHO1W": "Start Raid",
|
||||||
"My6HwN": "Ok, it's safe",
|
"My6HwN": "Ok, it's safe",
|
||||||
|
"NTpJIm": "Enable Recording",
|
||||||
"NnHu0L": "Please upload at least 1 video",
|
"NnHu0L": "Please upload at least 1 video",
|
||||||
"O2Cy6m": "Yes, I am over 18",
|
"O2Cy6m": "Yes, I am over 18",
|
||||||
"O7AeYh": "Description..",
|
"O7AeYh": "Description..",
|
||||||
|
Reference in New Issue
Block a user