feat: open profile from config ui

This commit is contained in:
Shusui MOYATANI
2023-05-01 13:12:07 +09:00
parent f0113d5f4d
commit 9a89ab813c

View File

@@ -4,6 +4,9 @@ import XMark from 'heroicons/24/outline/x-mark.svg';
import Modal from '@/components/Modal';
import useConfig, { type Config } from '@/core/useConfig';
import useModalState from '@/hooks/useModalState';
import usePubkey from '@/nostr/usePubkey';
import ensureNonNull from '@/utils/ensureNonNull';
import UserNameDisplay from './UserDisplayName';
@@ -11,6 +14,35 @@ type ConfigProps = {
onClose: () => void;
};
const ProfileSection = () => {
const pubkey = usePubkey();
const { showProfile, showProfileEdit } = useModalState();
return (
<div class="py-2">
<h3 class="font-bold"></h3>
<div class="flex gap-2">
<button
class="rounded border border-rose-300 px-4 py-2 font-bold text-rose-300"
onClick={() =>
ensureNonNull([pubkey()])(([pubkeyNonNull]) => {
showProfile(pubkeyNonNull);
})
}
>
</button>
<button
class="rounded border border-rose-300 px-4 py-2 font-bold text-rose-300"
onClick={() => showProfileEdit()}
>
</button>
</div>
</div>
);
};
const RelayConfig = () => {
const { config, addRelay, removeRelay } = useConfig();
@@ -267,6 +299,7 @@ const ConfigUI = (props: ConfigProps) => {
</button>
</div>
</div>
<ProfileSection />
<RelayConfig />
<DateFormatConfig />
<OtherConfig />