import * as React from "react"; import * as d from "../../localData"; import { Image } from "./Image"; import { Link } from "./Link"; import type { UseDefinyAppResult } from "../hook/useDefinyApp"; export type Props = Pick & { readonly accountId: d.AccountId; readonly onJump: UseDefinyAppResult["jump"]; }; export const AccountCard: React.VFC = React.memo((props) => { React.useEffect(() => { props.accountResource.requestToServerIfEmpty(props.accountId); }, [props.accountResource, props.accountId]); const accountResource = props.accountResource.getFromMemoryCache( props.accountId ); if (accountResource === undefined) { return
アカウント読み込み準備前
; } if (accountResource._ === "Deleted") { return
存在しないしないアカウント
; } if (accountResource._ === "Requesting") { return
アカウント取得中
; } if (accountResource._ === "Unknown") { return
アカウント取得に失敗
; } const account = accountResource.dataWithTime.data; return ( {account.name {account.name} ); }); AccountCard.displayName = "AccountCard";