/** @jsx h */ import { h } from "https://esm.sh/preact@10.17.1"; import { tw } from "https://esm.sh/twind@0.16.16"; import { AboutIcon, AppListIcon } from "./icons/mod.tsx"; import * as db from "../database.ts"; import { Avatar } from "./components/avatar.tsx"; import { CenterClass, NoOutlineClass } from "./components/tw.ts"; import { emitFunc, EventEmitter } from "../event-bus.ts"; import { PublicKey } from "../lib/nostr-ts/key.ts"; import { ConnectionPool } from "../lib/nostr-ts/relay.ts"; import { PrimaryBackgroundColor, PrimaryTextColor, SecondaryBackgroundColor, SecondaryTextColor, } from "./style/colors.ts"; import { ChatIcon } from "./icons2/chat-icon.tsx"; import { UserIcon } from "./icons2/user-icon.tsx"; import { SocialIcon } from "./icons2/social-icon.tsx"; import { SettingIcon } from "./icons2/setting-icon.tsx"; export type Props = { profilePicURL: string | undefined; publicKey: PublicKey; database: db.Database_Contextual_View; pool: ConnectionPool; emit: emitFunc; } & NavigationModel; export type ActiveNav = ActiveTab | "Setting"; export type ActiveTab = "DM" | /* "Group" | */ "Profile" | "About" | "AppList"; export type NavigationModel = { activeNav: ActiveNav; }; export type NavigationUpdate = { type: "ChangeNavigation"; index: ActiveNav; }; const navTabLayoutOrder: ActiveTab[] = ["DM", /*"Group",*/ "Profile", "About", "AppList"]; const tabs = { "DM": (active: boolean) => ( ), "Profile": (active: boolean) => ( ), "About": (active: boolean) => ( ), "AppList": (active: boolean) => ( ), }; export function NavBar(props: Props) { return (
    {navTabLayoutOrder.map((tab) => { const tabComponent = tabs[tab]; return (
  • { props.emit({ type: "ChangeNavigation", index: tab, }); }} > {tabComponent(props.activeNav === tab)}
  • ); })}
); } export function MobileNavBar(props: Props) { return (
    {navTabLayoutOrder.map((tab) => { const tabComponent = tabs[tab]; return (
  • { props.emit({ type: "ChangeNavigation", index: tab, }); }} > {tabComponent(props.activeNav === tab)}
  • ); })}
); }