Skip to content

Commit

Permalink
feat: always display full Target Support grid, improve translatability
Browse files Browse the repository at this point in the history
  • Loading branch information
budak7273 committed Sep 29, 2024
1 parent bc784fc commit 08278ad
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 17 deletions.
18 changes: 11 additions & 7 deletions src/lib/components/mods/ModLatestVersions.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import VersionTargetSupportGrid from '$lib/components/versions/VersionTargetSupportGrid.svelte';
import VersionDependenciesGrid from '$lib/components/versions/VersionDependenciesGrid.svelte';
import type { Version, VersionDependency, VersionTarget } from '$lib/generated';
import { T } from '@tolgee/svelte';
type IVersion = Pick<Version, 'id' | 'link' | 'version' | 'created_at'> & {
targets?: Pick<VersionTarget, 'targetName' | 'size' | 'hash'>[];
Expand All @@ -31,7 +32,7 @@
<div class="card p-4">
<section>
<div class="grid grid-flow-row gap-y-2">
<h3 class="my-4 text-2xl font-bold">{$t('mod.latest-versions')}</h3>
<h3 class="my-4 text-2xl font-bold"><T keyName="mod.latest-versions" defaultValue="Latest Versions" /></h3>

{#each Object.keys(stabilities) as stability}
{#if latestVersions[stability]}
Expand All @@ -43,22 +44,25 @@
<a
href="{base}/mod/{modId}/version/{latestVersions[stability].id}/"
class="text-yellow-500 underline"
title="Click to view patch notes for this version">Version {latestVersions[stability].version}</a>
title={$t('version.version-number.tooltip', 'Click to view patch notes for this version')}>
<T
keyName="version.version-number"
defaultValue={'Version {versionNumber}'}
params={{ versionNumber: latestVersions[stability].version }} /></a>
<div>{prettyDate(latestVersions[stability].created_at)}</div>
</div>
<div class="text-1xl col-span-3 h-auto w-auto p-2.5">
<a
href="#top"
on:click={() => installMod(modReference)}
title="Install via Satisfactory Mod Manager"
title={$t('version.install.tooltip', 'Install via Satisfactory Mod Manager')}
class="text-yellow-500">
<span class="material-icons align-middle" style="font-size: 118x;">download</span> <u>Install</u>
<span class="material-icons align-middle" style="font-size: 118x;">download</span>
<u><T keyName="version.install" defaultValue="Install" /></u>
</a>
</div>
</div>
{#if latestVersions[stability].targets.length > 1}
<VersionTargetSupportGrid targets={latestVersions[stability].targets} />
{/if}
<VersionTargetSupportGrid targets={latestVersions[stability].targets} />
<VersionDependenciesGrid dependencies={latestVersions[stability].dependencies} />
{/if}
{/each}
Expand Down
49 changes: 39 additions & 10 deletions src/lib/components/versions/VersionTargetSupportGrid.svelte
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
<script lang="ts">
import type { VersionTarget } from '$lib/generated';
import { getTranslate } from '@tolgee/svelte';
import { T } from '@tolgee/svelte';
export const { t } = getTranslate();
export let targets!: Pick<VersionTarget, 'targetName'>[];
function formatTooltip(found: boolean, selectedTarget: string) {
if (found) {
return `This version supports the ${selectedTarget} target`;
function formatTooltip(filesFoundForTarget: boolean, selectedTarget: string) {
if (filesFoundForTarget) {
return $t({
key: 'version.target-support-tooltip.supported',
defaultValue: `This version supports the {TargetPlatform} platform`,
params: {
TargetPlatform: selectedTarget
}
});
}
return `This version lacks files for the ${selectedTarget} target`;
return $t({
key: 'version.target-support-tooltip.unsupported',
defaultValue: `This version does not support the {TargetPlatform} platform`,
params: {
TargetPlatform: selectedTarget
}
});
}
const yesGlyph = 'checkmark';
Expand Down Expand Up @@ -36,11 +51,17 @@
<tbody>
<tr class="rounded border !border-surface-500">
<td style="width: 20%;" />
<td style="width: 40%;"><div class="text-center" title="Game client">Client</div></td>
<td style="width: 40%;"><div class="text-center" title="Dedicated server">Server</div></td>
<td style="width: 40%;"
><div class="text-center" title="Game client">
<T keyName="target-platform.client" defaultValue="Client" />
</div></td>
<td style="width: 40%;"
><div class="text-center" title="Dedicated server">
<T keyName="target-platform.server" defaultValue="Server" />
</div></td>
</tr>
<tr class="rounded border !border-surface-500">
<td>Windows</td>
<td><T keyName="target-platform.windows" defaultValue="Windows" /></td>
<td
><div class="text-center">
<span class="material-icons text-center" style="width: 20px" title={WindowsSupport.tooltip}
Expand All @@ -53,8 +74,16 @@
</div></td>
</tr>
<tr class="rounded border !border-surface-500">
<td>Linux</td>
<td><div class="text-center" title="There is no Client distribution of Satisfactory for Linux">N/A</div></td>
<td><T keyName="target-platform.linux" defaultValue="Linux" /></td>
<td
><div
class="text-center"
title={$t(
'version.target-support-tooltip.no-linux-client',
'There is no Client distribution of Satisfactory for Linux'
)}>
<T keyName="not-applicable.abbreviation" defaultValue="N/A" />
</div></td>
<td
><div class="text-center">
<span class="material-icons text-center" style="width: 20px" title={LinuxServerSupport.tooltip}
Expand Down

0 comments on commit 08278ad

Please sign in to comment.