diff --git a/src/components/profile-info-dialog.tsx b/src/components/profile-info-dialog.tsx index 735c391..c7f03a2 100644 --- a/src/components/profile-info-dialog.tsx +++ b/src/components/profile-info-dialog.tsx @@ -82,6 +82,15 @@ function OSIcon({ os }: { os: string }) { } } +function InfoCard({ label, value }: { label: string; value: string }) { + return ( +
+

{label}

+

{value}

+
+ ); +} + export function ProfileInfoDialog({ isOpen, onClose, @@ -222,110 +231,12 @@ export function ProfileInfoDialog({ void updateBypassRules(bypassRules.filter((r) => r !== rule)); }; - const infoFields: { label: string; value: React.ReactNode }[] = [ - { - label: t("profileInfo.fields.profileId"), - value: ( - - - {profile.id} - - - - ), - }, - { - label: t("profileInfo.fields.browser"), - value: `${getBrowserDisplayName(profile.browser)} ${profile.version}`, - }, - { - label: t("profileInfo.fields.releaseType"), - value: - profile.release_type.charAt(0).toUpperCase() + - profile.release_type.slice(1), - }, - { - label: t("profileInfo.fields.proxyVpn"), - value: networkLabel, - }, - { - label: t("profileInfo.fields.group"), - value: groupName ?? t("profileInfo.values.none"), - }, - { - label: t("profileInfo.fields.extensionGroup"), - value: extensionGroupName ?? t("profileInfo.values.none"), - }, - { - label: t("profileInfo.fields.tags"), - value: - profile.tags && profile.tags.length > 0 ? ( - - {profile.tags.map((tag) => ( - - {tag} - - ))} - - ) : ( - t("profileInfo.values.none") - ), - }, - { - label: t("profileInfo.fields.note"), - value: profile.note || t("profileInfo.values.none"), - }, - { - label: t("profileInfo.fields.syncStatus"), - value: syncLabel, - }, - { - label: t("profileInfo.fields.lastLaunched"), - value: profile.last_launch - ? formatRelativeTime(profile.last_launch) - : t("profileInfo.values.never"), - }, - ]; - - if (profile.host_os && isCrossOsProfile(profile)) { - infoFields.push({ - label: t("profileInfo.fields.hostOs"), - value: ( - - - {getOSDisplayName(profile.host_os)} - - ), - }); - } - - if (profile.created_by_email) { - infoFields.push({ - label: t("sync.team.title"), - value: t("sync.team.createdBy", { email: profile.created_by_email }), - }); - } - - if (profile.ephemeral) { - infoFields.push({ - label: t("profileInfo.fields.ephemeral"), - value: ( - - {t("profileInfo.values.yes")} - - ), - }); - } + const releaseLabel = + profile.release_type.charAt(0).toUpperCase() + + profile.release_type.slice(1); + const hasTags = profile.tags && profile.tags.length > 0; + const hasNote = !!profile.note; + const showCrossOs = !!(profile.host_os && isCrossOsProfile(profile)); type ActionItem = { icon: React.ReactNode; @@ -413,7 +324,7 @@ export function ProfileInfoDialog({ return ( <> !open && onClose()}> - + {t("profileInfo.title")} @@ -428,22 +339,156 @@ export function ProfileInfoDialog({ -
- -

{profile.name}

-

- {getBrowserDisplayName(profile.browser)} {profile.version} -

-
-
- {infoFields.map((field) => ( - - - {field.label} +
+ {/* Hero */} +
+
+ +
+
+

+ {profile.name} +

+
+ + {getBrowserDisplayName(profile.browser)}{" "} + {profile.version} + + + {releaseLabel} + + {isRunning && ( + + {t("common.status.running")} + + )} + {profile.ephemeral && ( + + {t("profiles.ephemeralBadge")} + + )} + {showCrossOs && profile.host_os && ( + + + {getOSDisplayName(profile.host_os)} + + )} +
+
+
+ + {/* Profile ID */} +
+ + ID + + + {profile.id} + + +
+ + {/* Network & Organization */} +
+ + + + +
+ + {/* Sync */} +
+
+

+ {t("profileInfo.fields.syncStatus")} +

+

{syncLabel}

+
+ + {syncMode === "Disabled" + ? t("sync.mode.disabled") + : syncStatus?.status === "syncing" + ? t("common.status.syncing") + : t("common.status.synced")} + +
+ + {/* Tags */} + {hasTags && ( +
+ + {t("profileInfo.fields.tags")} - {field.value} - - ))} +
+ {profile.tags?.map((tag) => ( + + {tag} + + ))} +
+
+ )} + + {/* Note */} + {hasNote && ( +
+ + {t("profileInfo.fields.note")} + +

+ {profile.note} +

+
+ )} + + {/* Team */} + {profile.created_by_email && ( +
+

+ {t("sync.team.title")} +

+

+ {t("sync.team.createdBy", { + email: profile.created_by_email, + })} +

+
+ )}