feat: update default column informations

This commit is contained in:
reya 2024-03-21 14:53:08 +07:00
parent cb565ff35b
commit dd7155a3a6
19 changed files with 90 additions and 44 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 KiB

View File

@ -1,6 +1,6 @@
import { Col } from "@/components/col"; import { Col } from "@/components/col";
import { Toolbar } from "@/components/toolbar"; import { Toolbar } from "@/components/toolbar";
import { LoaderIcon } from "@lume/icons"; import { LoaderIcon, PlusIcon } from "@lume/icons";
import { EventColumns, LumeColumn } from "@lume/types"; import { EventColumns, LumeColumn } from "@lume/types";
import { createFileRoute } from "@tanstack/react-router"; import { createFileRoute } from "@tanstack/react-router";
import { UnlistenFn } from "@tauri-apps/api/event"; import { UnlistenFn } from "@tauri-apps/api/event";
@ -13,9 +13,8 @@ export const Route = createFileRoute("/$account/home")({
pendingComponent: Pending, pendingComponent: Pending,
}); });
const COLS: LumeColumn[] = [ const DEFAULT_COLUMNS: LumeColumn[] = [
{ id: 1, name: "Newsfeed", content: "/newsfeed" }, { id: 1, name: "Newsfeed", content: "/newsfeed" },
{ id: 9999, name: "Lume Store", content: "/store/official" },
]; ];
function Screen() { function Screen() {
@ -23,7 +22,7 @@ function Screen() {
const vlistRef = useRef<VListHandle>(null); const vlistRef = useRef<VListHandle>(null);
const unlisten = useRef<UnlistenFn>(null); const unlisten = useRef<UnlistenFn>(null);
const [columns, setColumns] = useState(COLS); const [columns, setColumns] = useState(DEFAULT_COLUMNS);
const [selectedIndex, setSelectedIndex] = useState(-1); const [selectedIndex, setSelectedIndex] = useState(-1);
const [isScroll, setIsScroll] = useState(false); const [isScroll, setIsScroll] = useState(false);

View File

@ -11,7 +11,8 @@ export const Route = createFileRoute("/store/official")({
name: "For you", name: "For you",
content: "/foryou", content: "/foryou",
logo: "", logo: "",
cover: "", cover: "/foryou.png",
coverRetina: "/foryou@2x.png",
author: "Lume", author: "Lume",
description: "Keep up to date with content based on your interests.", description: "Keep up to date with content based on your interests.",
}, },
@ -20,7 +21,8 @@ export const Route = createFileRoute("/store/official")({
name: "Group Feeds", name: "Group Feeds",
content: "/group", content: "/group",
logo: "", logo: "",
cover: "", cover: "/group.png",
coverRetina: "/group@2x.png",
author: "Lume", author: "Lume",
description: "Collective of people you're interested in.", description: "Collective of people you're interested in.",
}, },
@ -29,7 +31,8 @@ export const Route = createFileRoute("/store/official")({
name: "Antenas", name: "Antenas",
content: "/antenas", content: "/antenas",
logo: "", logo: "",
cover: "", cover: "/antenas.png",
coverRetina: "/antenas@2x.png",
author: "Lume", author: "Lume",
description: "Keep track to specific content.", description: "Keep track to specific content.",
}, },
@ -38,7 +41,8 @@ export const Route = createFileRoute("/store/official")({
name: "Trending", name: "Trending",
content: "/trending", content: "/trending",
logo: "", logo: "",
cover: "", cover: "/trending.png",
coverRetina: "/trending@2x.png",
author: "Lume", author: "Lume",
description: "What is trending on Nostr?.", description: "What is trending on Nostr?.",
}, },
@ -47,7 +51,8 @@ export const Route = createFileRoute("/store/official")({
name: "Global", name: "Global",
content: "/global", content: "/global",
logo: "", logo: "",
cover: "", cover: "/global.png",
coverRetina: "/global@2x.png",
author: "Lume", author: "Lume",
description: "All events from connected relays.", description: "All events from connected relays.",
}, },
@ -56,7 +61,8 @@ export const Route = createFileRoute("/store/official")({
name: "Waifu", name: "Waifu",
content: "/waifu", content: "/waifu",
logo: "", logo: "",
cover: "", cover: "/waifu.png",
coverRetina: "/waifu@2x.png",
author: "Lume", author: "Lume",
description: "Show a random waifu image to boost your morale.", description: "Show a random waifu image to boost your morale.",
}, },
@ -80,11 +86,21 @@ function Screen() {
key={column.id} key={column.id}
className="relative h-[200px] w-full overflow-hidden rounded-xl bg-gradient-to-tr from-orange-100 to-blue-200 px-3 pt-3" className="relative h-[200px] w-full overflow-hidden rounded-xl bg-gradient-to-tr from-orange-100 to-blue-200 px-3 pt-3"
> >
<div className="absolute bottom-0 left-0 h-16 w-full bg-black/40 px-3 backdrop-blur-xl"> {column.cover ? (
<img
src={column.cover}
srcSet={column.coverRetina}
alt={column.name}
loading="lazy"
decoding="async"
className="absolute left-0 top-0 z-10 h-full w-full object-cover"
/>
) : null}
<div className="absolute bottom-0 left-0 z-20 h-16 w-full bg-black/40 px-3 backdrop-blur-xl">
<div className="flex h-full items-center justify-between"> <div className="flex h-full items-center justify-between">
<div> <div>
<h1 className="font-semibold text-white">{column.name}</h1> <h1 className="font-semibold text-white">{column.name}</h1>
<p className="max-w-[18rem] truncate text-sm text-white/80"> <p className="max-w-[24rem] truncate text-sm text-white/80">
{column.description} {column.description}
</p> </p>
</div> </div>

View File

@ -4,20 +4,13 @@ export function ChevronDownIcon(
props: JSX.IntrinsicAttributes & SVGProps<SVGSVGElement>, props: JSX.IntrinsicAttributes & SVGProps<SVGSVGElement>,
) { ) {
return ( return (
<svg <svg width="24" height="24" fill="none" viewBox="0 0 24 24" {...props}>
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
fill="none"
viewBox="0 0 24 24"
{...props}
>
<path <path
stroke="currentColor" stroke="currentColor"
strokeLinecap="round" strokeLinecap="round"
strokeLinejoin="round" strokeLinejoin="round"
strokeWidth="2" strokeWidth="1.5"
d="M6 9a30.618 30.618 0 005.49 5.817c.3.244.72.244 1.02 0A30.617 30.617 0 0018 9" d="m20 9-6.586 6.586a2 2 0 0 1-2.828 0L4 9"
/> />
</svg> </svg>
); );

View File

@ -86,8 +86,10 @@ export interface LumeColumn {
content: URL | string; content: URL | string;
description?: string; description?: string;
author?: string; author?: string;
logo?: URL | string; logo?: string;
cover?: URL | string; cover?: string;
coverRetina?: string;
featured?: boolean;
} }
export interface EventColumns { export interface EventColumns {

View File

@ -1,4 +1,6 @@
import { ChevronDownIcon, RefreshIcon } from "@lume/icons";
import { cn } from "@lume/utils"; import { cn } from "@lume/utils";
import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
export function ColumnHeader({ export function ColumnHeader({
name, name,
@ -7,16 +9,40 @@ export function ColumnHeader({
name: string; name: string;
className?: string; className?: string;
}) { }) {
const reload = () => {
window.location.reload();
};
return ( return (
<DropdownMenu.Root>
<div <div
className={cn( className={cn(
"flex h-11 w-full shrink-0 items-center justify-center gap-2 border-b border-neutral-100 dark:border-neutral-900", "flex h-11 w-full shrink-0 items-center justify-center gap-2 border-b border-neutral-100 dark:border-neutral-900",
className, className,
)} )}
> >
<div className="inline-flex items-center gap-1.5"> <DropdownMenu.Trigger asChild>
<button type="button" className="inline-flex items-center gap-2">
<div className="text-[13px] font-medium">{name}</div> <div className="text-[13px] font-medium">{name}</div>
<ChevronDownIcon className="size-4" />
</button>
</DropdownMenu.Trigger>
</div> </div>
</div> <DropdownMenu.Portal>
<DropdownMenu.Content
sideOffset={5}
className="flex w-[200px] flex-col overflow-hidden rounded-xl bg-black p-1 focus:outline-none dark:bg-white"
>
<DropdownMenu.Item
onClick={reload}
className="inline-flex h-9 items-center gap-3 rounded-lg px-3 text-sm font-medium text-white hover:bg-neutral-900 focus:outline-none dark:text-black dark:hover:bg-neutral-100"
>
<RefreshIcon className="size-4" />
Reload
</DropdownMenu.Item>
<DropdownMenu.Arrow className="fill-black dark:fill-white" />
</DropdownMenu.Content>
</DropdownMenu.Portal>
</DropdownMenu.Root>
); );
} }

View File

@ -1,5 +1,5 @@
import { VerifiedIcon } from "@lume/icons"; import { VerifiedIcon } from "@lume/icons";
import { cn, displayNpub } from "@lume/utils"; import { cn, displayLongHandle, displayNpub } from "@lume/utils";
import { useQuery } from "@tanstack/react-query"; import { useQuery } from "@tanstack/react-query";
import { useUserContext } from "./provider"; import { useUserContext } from "./provider";
import { useArk } from "@lume/ark"; import { useArk } from "@lume/ark";
@ -23,7 +23,9 @@ export function UserNip05({ className }: { className?: string }) {
<p className={cn("text-sm", className)}> <p className={cn("text-sm", className)}>
{!user.profile?.nip05 {!user.profile?.nip05
? displayNpub(user.pubkey, 16) ? displayNpub(user.pubkey, 16)
: user.profile?.nip05.replace("_@", "")} : user.profile?.nip05.length > 16
? displayLongHandle(user.profile?.nip05)
: user.profile.nip05?.replace("_@", "")}
</p> </p>
{!isLoading && verified ? ( {!isLoading && verified ? (
<VerifiedIcon className="size-4 text-teal-500" /> <VerifiedIcon className="size-4 text-teal-500" />

View File

@ -65,6 +65,14 @@ export function displayNpub(pubkey: string, len: number) {
); );
} }
export function displayLongHandle(str: string) {
const split = str.split("@");
const handle = split[0];
const service = split[1];
return handle.substring(0, 16) + "..." + "@" + service;
}
// convert number to K, M, B, T, etc. // convert number to K, M, B, T, etc.
export const compactNumber = Intl.NumberFormat("en", { notation: "compact" }); export const compactNumber = Intl.NumberFormat("en", { notation: "compact" });