App installs: fix missing treaty info on install

This commit is contained in:
Patrick O'Sullivan 2023-03-09 15:38:52 -06:00
parent 8232b8f00b
commit 6c80025e6f
2 changed files with 19 additions and 6 deletions

View File

@ -18,6 +18,7 @@ type App = ChargeWithDesk | Treaty;
interface AppInfoProps {
docket: App;
pike?: Pike;
treatyInfoShip?: string;
className?: string;
}
@ -34,20 +35,25 @@ function getInstallStatus(docket: App): InstallStatus {
return 'uninstalled';
}
function getRemoteDesk(docket: App, pike?: Pike) {
function getRemoteDesk(docket: App, pike?: Pike, treatyInfoShip?: string) {
if (pike && pike.sync) {
return [pike.sync.ship, pike.sync.desk];
}
if ('chad' in docket) {
return ['', docket.desk];
return [treatyInfoShip ?? '', docket.desk];
}
const { ship, desk } = docket;
return [ship, desk];
}
export const AppInfo: FC<AppInfoProps> = ({ docket, pike, className }) => {
export const AppInfo: FC<AppInfoProps> = ({
docket,
pike,
className,
treatyInfoShip,
}) => {
const installStatus = getInstallStatus(docket);
const [ship, desk] = getRemoteDesk(docket, pike);
const [ship, desk] = getRemoteDesk(docket, pike, treatyInfoShip);
const publisher = pike?.sync?.ship ?? ship;
const [copied, setCopied] = useState(false);
const treaty = useTreaty(ship, desk);

View File

@ -30,9 +30,16 @@ export const TreatyInfo = () => {
// TODO: maybe replace spinner with skeletons
return (
<div className="dialog-inner-container flex justify-center text-black">
<Spinner className="w-10 h-10" />
<Spinner className="h-10 w-10" />
</div>
);
}
return <AppInfo className="dialog-inner-container" docket={charge || treaty} pike={pike} />;
return (
<AppInfo
treatyInfoShip={treaty.ship}
className="dialog-inner-container"
docket={charge || treaty}
pike={pike}
/>
);
};