feat: theme color
This commit is contained in:
@ -41,7 +41,7 @@ export function VideoTile({
|
|||||||
<span className="pill-box">
|
<span className="pill-box">
|
||||||
{showStatus && <StatePill state={status as StreamState} />}
|
{showStatus && <StatePill state={status as StreamState} />}
|
||||||
{viewers && (
|
{viewers && (
|
||||||
<span className="pill viewers">
|
<span className="pill viewers bg-gray-1">
|
||||||
<FormattedMessage defaultMessage="{n} viewers" id="3adEeb" values={{ n: formatSats(Number(viewers)) }} />
|
<FormattedMessage defaultMessage="{n} viewers" id="3adEeb" values={{ n: formatSats(Number(viewers)) }} />
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
|
@ -206,6 +206,9 @@
|
|||||||
"Oxqtyf": {
|
"Oxqtyf": {
|
||||||
"defaultMessage": "We hooked you up with a lightning wallet so you can get paid by viewers right away!"
|
"defaultMessage": "We hooked you up with a lightning wallet so you can get paid by viewers right away!"
|
||||||
},
|
},
|
||||||
|
"Pe0ogR": {
|
||||||
|
"defaultMessage": "Theme"
|
||||||
|
},
|
||||||
"Q3au2v": {
|
"Q3au2v": {
|
||||||
"defaultMessage": "About {estimate}"
|
"defaultMessage": "About {estimate}"
|
||||||
},
|
},
|
||||||
|
@ -23,6 +23,7 @@ export interface LoginSession {
|
|||||||
muted: ReplaceableTags;
|
muted: ReplaceableTags;
|
||||||
cards: ReplaceableTags;
|
cards: ReplaceableTags;
|
||||||
emojis: Array<EmojiPack>;
|
emojis: Array<EmojiPack>;
|
||||||
|
color?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const initialState = {
|
const initialState = {
|
||||||
@ -114,6 +115,12 @@ export class LoginStore extends ExternalStore<LoginSession | undefined> {
|
|||||||
this.#save();
|
this.#save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setColor(color: string) {
|
||||||
|
if (!this.#session) return;
|
||||||
|
this.#session.color = color;
|
||||||
|
this.#save();
|
||||||
|
}
|
||||||
|
|
||||||
#save() {
|
#save() {
|
||||||
if (this.#session) {
|
if (this.#session) {
|
||||||
window.localStorage.setItem(SESSION_KEY, JSON.stringify(this.#session));
|
window.localStorage.setItem(SESSION_KEY, JSON.stringify(this.#session));
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import "./layout.css";
|
import "./layout.css";
|
||||||
|
|
||||||
import { useState, useSyncExternalStore } from "react";
|
import { CSSProperties, useState, useSyncExternalStore } from "react";
|
||||||
import * as Dialog from "@radix-ui/react-dialog";
|
import * as Dialog from "@radix-ui/react-dialog";
|
||||||
import { Outlet, useNavigate } from "react-router-dom";
|
import { Outlet, useNavigate } from "react-router-dom";
|
||||||
import { Helmet } from "react-helmet";
|
import { Helmet } from "react-helmet";
|
||||||
@ -120,8 +120,12 @@ export function LayoutPage() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const styles = {} as CSSProperties;
|
||||||
|
if (login?.color) {
|
||||||
|
(styles as Record<string, string>)["--primary"] = login.color;
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<div className={`page${location.pathname.startsWith("/naddr1") ? " stream" : ""}`}>
|
<div className={`page${location.pathname.startsWith("/naddr1") ? " stream" : ""}`} style={styles}>
|
||||||
<Helmet>
|
<Helmet>
|
||||||
<title>Home - zap.stream</title>
|
<title>Home - zap.stream</title>
|
||||||
</Helmet>
|
</Helmet>
|
||||||
|
@ -8,6 +8,8 @@ import { useLogin } from "@/hooks/login";
|
|||||||
import Copy from "@/element/copy";
|
import Copy from "@/element/copy";
|
||||||
import { NostrProviderDialog } from "@/element/nostr-provider-dialog";
|
import { NostrProviderDialog } from "@/element/nostr-provider-dialog";
|
||||||
import { useStreamProvider } from "@/hooks/stream-provider";
|
import { useStreamProvider } from "@/hooks/stream-provider";
|
||||||
|
import { Login, StreamState } from "..";
|
||||||
|
import { StatePill } from "@/element/state-pill";
|
||||||
|
|
||||||
const enum Tab {
|
const enum Tab {
|
||||||
Account,
|
Account,
|
||||||
@ -50,6 +52,21 @@ export function SettingsPage() {
|
|||||||
<Copy text={hexToBech32("nsec", login.privateKey)} />
|
<Copy text={hexToBech32("nsec", login.privateKey)} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
<h1>
|
||||||
|
<FormattedMessage defaultMessage="Theme" id="Pe0ogR" />
|
||||||
|
</h1>
|
||||||
|
<div>
|
||||||
|
<StatePill state={StreamState.Live} />
|
||||||
|
</div>
|
||||||
|
<div className="flex gap-2">
|
||||||
|
{["#7F006A", "#E206BF", "#7406E2", "#3F06E2", "#393939", "#ff563f", "#ff8d2b", "#34d2fe"].map(a => (
|
||||||
|
<div
|
||||||
|
className={`w-4 h-4 pointer${login?.color === a ? " border" : ""}`}
|
||||||
|
title={a}
|
||||||
|
style={{ backgroundColor: a }}
|
||||||
|
onClick={() => Login.setColor(a)}></div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
<h1>
|
<h1>
|
||||||
<FormattedMessage defaultMessage="Zaps" id="OEW7yJ" />
|
<FormattedMessage defaultMessage="Zaps" id="OEW7yJ" />
|
||||||
</h1>
|
</h1>
|
||||||
|
@ -58,11 +58,9 @@ function ProfileInfo({ ev, goal }: { ev?: NostrEvent; goal?: TaggedNostrEvent })
|
|||||||
<p>{findTag(ev, "summary")}</p>
|
<p>{findTag(ev, "summary")}</p>
|
||||||
<div className="tags">
|
<div className="tags">
|
||||||
<StatePill state={status as StreamState} />
|
<StatePill state={status as StreamState} />
|
||||||
{viewers > 0 && (
|
|
||||||
<span className="pill bg-gray-1">
|
<span className="pill bg-gray-1">
|
||||||
<FormattedMessage defaultMessage="{n} viewers" id="3adEeb" values={{ n: formatSats(viewers) }} />
|
<FormattedMessage defaultMessage="{n} viewers" id="3adEeb" values={{ n: formatSats(viewers) }} />
|
||||||
</span>
|
</span>
|
||||||
)}
|
|
||||||
{status === StreamState.Live && (
|
{status === StreamState.Live && (
|
||||||
<span className="pill bg-gray-1">
|
<span className="pill bg-gray-1">
|
||||||
<StreamTimer ev={ev} />
|
<StreamTimer ev={ev} />
|
||||||
|
@ -68,6 +68,7 @@
|
|||||||
"OKhRC6": "Share",
|
"OKhRC6": "Share",
|
||||||
"OWgHbg": "Edit card",
|
"OWgHbg": "Edit card",
|
||||||
"Oxqtyf": "We hooked you up with a lightning wallet so you can get paid by viewers right away!",
|
"Oxqtyf": "We hooked you up with a lightning wallet so you can get paid by viewers right away!",
|
||||||
|
"Pe0ogR": "Theme",
|
||||||
"Q3au2v": "About {estimate}",
|
"Q3au2v": "About {estimate}",
|
||||||
"QRHNuF": "What are we steaming today?",
|
"QRHNuF": "What are we steaming today?",
|
||||||
"QRRCp0": "Stream URL",
|
"QRRCp0": "Stream URL",
|
||||||
|
Reference in New Issue
Block a user