wip: convert more components to new ui

This commit is contained in:
Ren Amamiya
2023-08-02 08:28:43 +07:00
parent 1ddcbf1654
commit a85bcf917b
23 changed files with 87 additions and 90 deletions

View File

@@ -30,7 +30,7 @@ export function ComposerModal() {
<>
<Button onClick={() => toggle(true)} preset="small">
<ComposeIcon className="h-4 w-4" />
Compose
Postr
</Button>
<Transition appear show={open} as={Fragment}>
<Dialog as="div" className="relative z-10" onClose={closeModal}>

View File

@@ -27,9 +27,9 @@ export function ImagePreview({ urls, truncate }: { urls: string[]; truncate?: bo
<button
type="button"
onClick={() => downloadImage(url)}
className="absolute right-3 top-3 hidden h-7 w-7 items-center justify-center rounded-md bg-black/70 backdrop-blur-md hover:bg-fuchsia-500 group-hover:inline-flex"
className="absolute right-2 top-2 hidden h-8 w-8 items-center justify-center rounded-md bg-black/50 backdrop-blur-md hover:bg-black/40 group-hover:inline-flex"
>
<DownloadIcon className="h-4 w-4 text-zinc-100" />
<DownloadIcon className="h-5 w-5 text-white" />
</button>
</div>
))}

View File

@@ -26,17 +26,17 @@ export function NoteReplyForm({ id, pubkey }: { id: string; pubkey: string }) {
};
return (
<div className="flex flex-col rounded-xl border-t border-zinc-800/50 bg-zinc-900">
<div className="mt-3 flex flex-col rounded-xl bg-white/10">
<div className="relative w-full flex-1 overflow-hidden">
<textarea
value={value}
onChange={(e) => setValue(e.target.value)}
placeholder="Reply to this thread..."
className=" relative h-24 w-full resize-none rounded-md bg-transparent px-3 py-3 text-base !outline-none placeholder:text-zinc-400 dark:text-zinc-100 dark:placeholder:text-zinc-500"
className=" relative h-24 w-full resize-none rounded-md bg-transparent px-3 py-3 text-base text-white !outline-none placeholder:text-white/50"
spellCheck={false}
/>
</div>
<div className="w-full border-t border-zinc-800 px-3 py-3">
<div className="w-full border-t border-white/10 px-3 py-3">
{status === 'loading' ? (
<div>
<p>Loading...</p>
@@ -53,8 +53,8 @@ export function NoteReplyForm({ id, pubkey }: { id: string; pubkey: string }) {
/>
</div>
<div>
<p className="mb-1 text-sm leading-none text-zinc-400">Reply as</p>
<p className="text-sm font-medium leading-none text-zinc-100">
<p className="mb-1 text-sm leading-none text-white/50">Reply as</p>
<p className="text-sm font-medium leading-none text-white">
{user?.nip05 || user?.name || displayNpub(pubkey, 16)}
</p>
</div>

View File

@@ -11,7 +11,7 @@ export function Reply({ event, root }: { event: LumeEvent; root?: string }) {
return (
<div className="h-min w-full py-1.5">
<div className="relative overflow-hidden rounded-xl border-t border-zinc-800/50 bg-zinc-900 px-3 pt-3">
<div className="relative overflow-hidden rounded-xl bg-white/10 px-3 pt-3">
<div className="relative flex flex-col">
<User pubkey={event.pubkey} time={event.created_at} />
<div className="relative z-20 -mt-6 flex items-start gap-3">

View File

@@ -54,14 +54,12 @@ export function RepliesList({ id }: { id: string }) {
return (
<div className="mt-3">
<div className="mb-2">
<h5 className="text-lg font-semibold text-zinc-300">
{data?.length || 0} replies
</h5>
<h5 className="text-lg font-semibold text-white">{data?.length || 0} replies</h5>
</div>
<div className="flex flex-col">
{data?.length === 0 ? (
<div className="px=3">
<div className="flex w-full items-center justify-center rounded-xl bg-zinc-900">
<div className="flex w-full items-center justify-center rounded-xl bg-white/10">
<div className="flex flex-col items-center justify-center gap-2 py-6">
<h3 className="text-3xl">👋</h3>
<p className="leading-none text-zinc-400">Share your thought on it...</p>

View File

@@ -61,22 +61,22 @@ export function NoteStats({ id }: { id: string }) {
return (
<div className="flex h-11 items-center gap-3">
<p className="text-zinc-500">
<span className="font-semibold text-zinc-300">
<p className="text-white/50">
<span className="font-semibold text-white">
{compactNumber.format(data.reactions)}
</span>{' '}
reactions
</p>
<span className="text-zinc-500">·</span>
<p className="text-zinc-500">
<span className="font-semibold text-zinc-300">
<span className="text-white/50">·</span>
<p className="text-white/50">
<span className="font-semibold text-white">
{compactNumber.format(data.reposts)}
</span>{' '}
reposts
</p>
<span className="text-zinc-500">·</span>
<p className="text-zinc-500">
<span className="font-semibold text-zinc-300">
<span className="text-white/50">·</span>
<p className="text-white/50">
<span className="font-semibold text-white">
{compactNumber.format(data.zaps)}
</span>{' '}
zaps

View File

@@ -25,20 +25,20 @@ export function ThreadUser({ pubkey, time }: { pubkey: string; time: number }) {
/>
<div className="lex flex-1 items-baseline justify-between">
<div className="inline-flex w-full items-center justify-between">
<h5 className="max-w-[15rem] truncate font-semibold leading-none text-zinc-100">
<h5 className="max-w-[15rem] truncate font-semibold leading-none text-white">
{user?.nip05?.toLowerCase() || user?.name || user?.display_name}
</h5>
<button
type="button"
className="inline-flex h-5 w-max items-center justify-center rounded px-1 hover:bg-zinc-800"
className="inline-flex h-5 w-max items-center justify-center rounded px-1 hover:bg-white/10"
>
<VerticalDotsIcon className="h-4 w-4 rotate-90 transform text-zinc-200" />
<VerticalDotsIcon className="h-4 w-4 rotate-90 transform text-white/50" />
</button>
</div>
<div className="mt-1 inline-flex items-center gap-2">
<span className="leading-none text-zinc-500">{createdAt}</span>
<span className="leading-none text-zinc-500">·</span>
<span className="leading-none text-zinc-500">{displayNpub(pubkey, 16)}</span>
<span className="leading-none text-white/50">{createdAt}</span>
<span className="leading-none text-white/50">·</span>
<span className="leading-none text-white/50">{displayNpub(pubkey, 16)}</span>
</div>
</div>
</div>

View File

@@ -13,7 +13,7 @@ export function Protected({ children }: { children: ReactNode }) {
if (status === 'loading') {
return (
<div className="flex h-full w-full items-center justify-center">
<div className="flex h-full w-full items-center justify-center bg-black/90">
<LoaderIcon className="h-6 w-6 animate-spin text-zinc-100" />
</div>
);

View File

@@ -11,14 +11,14 @@ export function TitleBar({ id, title }: { id?: string; title: string }) {
className="group flex h-11 w-full shrink-0 items-center justify-between overflow-hidden px-3"
>
<div className="w-6" />
<h3 className="text-sm font-medium text-zinc-200">{title}</h3>
<h3 className="text-sm font-medium text-white">{title}</h3>
{id ? (
<button
type="button"
onClick={() => remove.mutate(id)}
className="inline-flex h-6 w-6 shrink translate-y-8 transform items-center justify-center rounded transition-transform duration-150 ease-in-out hover:bg-zinc-900 group-hover:translate-y-0"
className="inline-flex h-6 w-6 shrink translate-y-8 transform items-center justify-center rounded transition-transform duration-150 ease-in-out hover:bg-white/10 group-hover:translate-y-0"
>
<CancelIcon width={12} height={12} className="text-zinc-300" />
<CancelIcon className="h-3 w-3 text-white" />
</button>
) : (
<div className="w-6" />

View File

@@ -54,19 +54,19 @@ export function UserProfile({ pubkey }: { pubkey: string }) {
src={user?.picture || user?.image}
fallback={DEFAULT_AVATAR}
alt={pubkey}
className="h-14 w-14 rounded-md ring-2 ring-black"
className="h-14 w-14 rounded-md"
/>
<div className="mt-2 flex flex-1 flex-col gap-2">
<div className="flex flex-col gap-2">
<h5 className="text-lg font-semibold leading-none">
{user?.displayName || user?.name || 'No name'}
</h5>
<span className="max-w-[15rem] truncate text-sm leading-none text-zinc-500">
<span className="max-w-[15rem] truncate text-sm leading-none text-white/50">
{user?.nip05 || displayNpub(pubkey, 16)}
</span>
</div>
<div className="flex flex-col gap-4">
<p className="mt-2 max-w-[500px] select-text break-words text-zinc-100">
<p className="mt-2 max-w-[500px] select-text break-words text-white">
{user?.about}
</p>
<UserMetadata pubkey={pubkey} />
@@ -75,7 +75,7 @@ export function UserProfile({ pubkey }: { pubkey: string }) {
{status === 'loading' ? (
<button
type="button"
className="inline-flex h-10 w-36 items-center justify-center rounded-md bg-zinc-900 text-sm font-medium hover:bg-fuchsia-500"
className="inline-flex h-10 w-36 items-center justify-center rounded-md bg-white/10 text-sm font-medium hover:bg-fuchsia-500"
>
Loading...
</button>
@@ -83,7 +83,7 @@ export function UserProfile({ pubkey }: { pubkey: string }) {
<button
type="button"
onClick={() => unfollowUser(pubkey)}
className="inline-flex h-10 w-36 items-center justify-center rounded-md bg-zinc-900 text-sm font-medium hover:bg-fuchsia-500"
className="inline-flex h-10 w-36 items-center justify-center rounded-md bg-white/10 text-sm font-medium hover:bg-fuchsia-500"
>
Unfollow
</button>
@@ -91,20 +91,20 @@ export function UserProfile({ pubkey }: { pubkey: string }) {
<button
type="button"
onClick={() => followUser(pubkey)}
className="inline-flex h-10 w-36 items-center justify-center rounded-md bg-zinc-900 text-sm font-medium hover:bg-fuchsia-500"
className="inline-flex h-10 w-36 items-center justify-center rounded-md bg-white/10 text-sm font-medium hover:bg-fuchsia-500"
>
Follow
</button>
)}
<Link
to={`/app/chats/${pubkey}`}
className="inline-flex h-10 w-36 items-center justify-center rounded-md bg-zinc-900 text-sm font-medium hover:bg-fuchsia-500"
className="inline-flex h-10 w-36 items-center justify-center rounded-md bg-white/10 text-sm font-medium hover:bg-fuchsia-500"
>
Message
</Link>
<button
type="button"
className="group inline-flex h-10 w-10 items-center justify-center rounded-md bg-zinc-900 text-sm font-medium hover:bg-orange-500"
className="group inline-flex h-10 w-10 items-center justify-center rounded-md bg-white/10 text-sm font-medium hover:bg-orange-500"
>
<ZapIcon className="h-5 w-5" />
</button>