Something went wrong. Try again.
fork of ozone with nix stuff
Something went wrong. Try again.
682 B · 27 lines
TSX
at main
12345678910111213141516171819202122232425262728import { getProfileUriForDid } from '@/reports/helpers/subject'import { getDidFromUri } from '@/lib/util'
export const SubjectSwitchButton = ({ subject, setSubject,}: { subject: string setSubject: (s: string) => void}) => { const isSubjectDid = subject.startsWith('did:') const text = isSubjectDid ? 'Switch to profile' : 'Switch to account' return ( <button className="ml-2 text-xs text-gray-500 underline" onClick={(e) => { e.preventDefault() const newSubject = isSubjectDid ? getProfileUriForDid(subject) : getDidFromUri(subject) setSubject(newSubject) }} > {text} </button> )}