Appease codestyle

This commit is contained in:
nexy7574 2024-12-30 19:23:52 +00:00
parent 55442da49d
commit 8b641cfd46
2 changed files with 25 additions and 37 deletions

View file

@ -61,16 +61,19 @@ function SetTimezoneElement({ tz, client }: SetTimezoneProps) {
) )
} }
} }
// TODO: You are unable to set a timezone if you do not already have one set in your profile.
// The defaulting to the current timezone causes `newTz !== tz` to never be true when the user has
// no timezone set.
return ( return (
<> <>
<input <input
list={"timezones"} list="timezones"
className={"text-input"} className="text-input"
defaultValue={tz || getCurrentTimezone()} defaultValue={tz || getCurrentTimezone()}
onChange={(e) => setTz(e.currentTarget.value)} onChange={(e) => setTz(e.currentTarget.value)}
/> />
<datalist id={"timezones"}> <datalist id="timezones">
{ {
zones.map((zone) => <option key={zone} value={zone} />) zones.map((zone) => <option key={zone} value={zone} />)
} }
@ -90,42 +93,27 @@ export default function UserExtendedProfile({ profile, client, userID }: Extende
// otherwise there's an ugly and pointless <hr/> for no real reason. // otherwise there's an ugly and pointless <hr/> for no real reason.
const pronouns: PronounSet[] = ensureArray(profile["io.fsky.nyx.pronouns"]) as PronounSet[] const pronouns: PronounSet[] = ensureArray(profile["io.fsky.nyx.pronouns"]) as PronounSet[]
const userTimezone: string | undefined = profile["us.cloke.msc4175.tz"]
return ( return (
<> <>
<hr/> <hr/>
<div className={"extended-profile"}> <div className="extended-profile">
{ {userTimezone && <>
profile["us.cloke.msc4175.tz"] && ( <div title={userTimezone}>Time:</div>
<> <ClockElement tz={userTimezone} />
<div title={profile["us.cloke.msc4175.tz"]}>Time:</div> </>}
<ClockElement tz={profile["us.cloke.msc4175.tz"]} /> {userID === client.userID && <>
</> <div>Set Timezone:</div>
) <SetTimezoneElement tz={userTimezone} client={client} />
} </>}
{ {pronouns.length >= 1 && <>
userID === client.userID && ( <div>Pronouns:</div>
<> <div>
<div>Set Timezone:</div> {pronouns.map((pronounSet: PronounSet) => (
<SetTimezoneElement tz={profile["us.cloke.msc4175.tz"]} client={client} /> pronounSet.summary || `${pronounSet.subject}/${pronounSet.object}`
</> )).join("/")}
) </div>
} </>}
{
pronouns.length >= 1 && (
<>
<div>Pronouns:</div>
<div>
{
pronouns.map(
(pronounSet: PronounSet) => (
pronounSet.summary || `${pronounSet.subject}/${pronounSet.object}`
),
).join("/")
}
</div>
</>
)
}
</div> </div>
</> </>
) )

View file

@ -18,11 +18,11 @@ import { PuffLoader } from "react-spinners"
import { getAvatarURL } from "@/api/media.ts" import { getAvatarURL } from "@/api/media.ts"
import { useRoomMember } from "@/api/statestore" import { useRoomMember } from "@/api/statestore"
import { MemberEventContent, UserID, UserProfile } from "@/api/types" import { MemberEventContent, UserID, UserProfile } from "@/api/types"
import UserExtendedProfile from "@/ui/rightpanel/UserExtendedProfile.tsx"
import { getLocalpart } from "@/util/validation.ts" import { getLocalpart } from "@/util/validation.ts"
import ClientContext from "../ClientContext.ts" import ClientContext from "../ClientContext.ts"
import { LightboxContext } from "../modal" import { LightboxContext } from "../modal"
import { RoomContext } from "../roomview/roomcontext.ts" import { RoomContext } from "../roomview/roomcontext.ts"
import UserExtendedProfile from "./UserExtendedProfile.tsx"
import DeviceList from "./UserInfoDeviceList.tsx" import DeviceList from "./UserInfoDeviceList.tsx"
import UserInfoError from "./UserInfoError.tsx" import UserInfoError from "./UserInfoError.tsx"
import MutualRooms from "./UserInfoMutualRooms.tsx" import MutualRooms from "./UserInfoMutualRooms.tsx"