update title bar

This commit is contained in:
2023-11-01 14:58:20 +07:00
parent f2dddf97f5
commit 3ad6830bfb
3 changed files with 54 additions and 34 deletions

View File

@@ -5,22 +5,41 @@ import { User } from '@shared/user';
import { useWidget } from '@utils/hooks/useWidget'; import { useWidget } from '@utils/hooks/useWidget';
export function TitleBar({ id, title }: { id?: string; title?: string }) { export function TitleBar({
id,
title,
isLive,
}: {
id?: string;
title?: string;
isLive?: boolean;
}) {
const { db } = useStorage(); const { db } = useStorage();
const { removeWidget } = useWidget(); const { removeWidget } = useWidget();
return ( return (
<div className="flex h-11 w-full shrink-0 items-center justify-between overflow-hidden px-3"> <div className="grid h-11 w-full shrink-0 grid-cols-3 items-center px-3">
<div className="w-6" /> <div className="col-span-1 flex justify-start">
{isLive ? (
<div className="flex items-center gap-1.5">
<span className="relative flex h-2 w-2">
<span className="absolute inline-flex h-full w-full animate-ping rounded-full bg-teal-400 opacity-75"></span>
<span className="relative inline-flex h-2 w-2 rounded-full bg-teal-500"></span>
</span>
<p className="text-xs font-medium text-teal-500">Live</p>
</div>
) : null}
</div>
<div className="col-span-1 flex justify-center">
{id === '9999' ? ( {id === '9999' ? (
<div className="isolate flex -space-x-2"> <div className="isolate flex -space-x-2">
{db.account.circles {db.account.circles
?.slice(0, 10) ?.slice(0, 8)
.map((item) => <User key={item} pubkey={item} variant="ministacked" />)} .map((item) => <User key={item} pubkey={item} variant="ministacked" />)}
{db.account.circles?.length > 10 ? ( {db.account.circles?.length > 8 ? (
<div className="inline-flex h-6 w-6 items-center justify-center rounded-full bg-neutral-200 text-neutral-900 ring-1 ring-neutral-300 dark:bg-neutral-800 dark:text-neutral-100 dark:ring-neutral-700"> <div className="inline-flex h-6 w-6 items-center justify-center rounded-full bg-neutral-300 text-neutral-900 ring-1 ring-white dark:bg-neutral-700 dark:text-neutral-100 dark:ring-black">
<span className="text-xs font-medium"> <span className="text-[8px] font-medium">
+{db.account.circles?.length - 10} +{db.account.circles?.length - 8}
</span> </span>
</div> </div>
) : null} ) : null}
@@ -30,6 +49,8 @@ export function TitleBar({ id, title }: { id?: string; title?: string }) {
{title} {title}
</h3> </h3>
)} )}
</div>
<div className="col-span-1 flex justify-end">
{id !== '9999' ? ( {id !== '9999' ? (
<button <button
type="button" type="button"
@@ -38,9 +59,8 @@ export function TitleBar({ id, title }: { id?: string; title?: string }) {
> >
<CancelIcon className="h-3 w-3" /> <CancelIcon className="h-3 w-3" />
</button> </button>
) : ( ) : null}
<div className="w-6" /> </div>
)}
</div> </div>
); );
} }

View File

@@ -140,7 +140,7 @@ export function NewsfeedWidget() {
return ( return (
<WidgetWrapper> <WidgetWrapper>
<TitleBar id="9999" /> <TitleBar id="9999" isLive />
<VList className="flex-1"> <VList className="flex-1">
{status === 'pending' ? ( {status === 'pending' ? (
<div className="px-3 py-1.5"> <div className="px-3 py-1.5">

View File

@@ -134,7 +134,7 @@ export function NotificationWidget() {
return ( return (
<WidgetWrapper> <WidgetWrapper>
<TitleBar id="9998" title="Notification" /> <TitleBar id="9998" title="Notification" isLive />
<VList className="flex-1"> <VList className="flex-1">
{status === 'pending' ? ( {status === 'pending' ? (
<div className="px-3 py-1.5"> <div className="px-3 py-1.5">