/** @jsx h */ import { Fragment, h } from "https://esm.sh/preact@10.11.3"; import { tw } from "https://esm.sh/twind@0.16.16"; import { Avatar } from "./components/avatar.tsx"; import { EventEmitter } from "../event-bus.ts"; import { ButtonClass, CenterClass, DividerClass, inputBorderClass, InputClass, LinearGradientsClass, NoOutlineClass, } from "./components/tw.ts"; import { ProfileData } from "../features/profile.ts"; import { DividerBackgroundColor, HintLinkColor, HintTextColor, HoverButtonBackgroudColor, PlaceholderColor, PrimaryTextColor, } from "./style/colors.ts"; export type MyProfileUpdate = | Edit | Save | EditNewProfileFieldKey | EditNewProfileFieldValue | InsertNewProfileField; export type Edit = { type: "EditMyProfile"; profile: ProfileData; }; type Save = { type: "SaveMyProfile"; profile: ProfileData; }; export type EditNewProfileFieldKey = { type: "EditNewProfileFieldKey"; key: string; }; export type EditNewProfileFieldValue = { type: "EditNewProfileFieldValue"; value: string; }; export type InsertNewProfileField = { type: "InsertNewProfileField"; }; export function EditProfile(props: { eventEmitter: EventEmitter; myProfile: ProfileData | undefined; newProfileField: { key: string; value: string; }; }) { return (
{props.myProfile?.banner ? (
) : ( )}

Name

Picture

You can upload your images on websites like{" "} nostr.build

About

Website

Banner

{props.myProfile ? Object.entries(props.myProfile).map(([key, value]) => { if (["name", "picture", "about", "website", "banner"].includes(key) || !value) { return undefined; } return (

{key}

); }) : undefined}

Custom Fields

Create your own custom fields, anything goes!

Field name

{ props.eventEmitter.emit({ type: "EditNewProfileFieldKey", key: e.currentTarget.value, }); }} type="text" class={tw`${InputClass}`} />

Field value

); }