Skip to content

Commit ef85bd3

Browse files
porisiusbudak7273mircearoata
authored
Optional Dependencies Grid (#169)
* Filter Optional Dependencies from ModDependency List may determine to create an optional dependency list later * mod.id -> mod.mod_reference Requested by Mircea https://discord.com/channels/555424930502541343/830842478956642354/1248726787857321995 * fix: added graphql tags and draft "Optional" tag * Tagged Optional -> Tabled Optional * feat: split deps into distinct tables with tooltips * feat: dotted underline on deps table headers * feat: only show optional deps table when they exist * chore: update aria-label * Make dependencies reactive Co-authored-by: mircearoata <mircearoatapalade@gmail.com> * chore: add gpg signing info to readme * fix: pass modref for smm install and modid for smr download --------- Co-authored-by: Rob B <computerguy440+gh@gmail.com> Co-authored-by: mircearoata <mircearoatapalade@gmail.com>
1 parent 3e75505 commit ef85bd3

File tree

9 files changed

+84
-20
lines changed

9 files changed

+84
-20
lines changed

.devcontainer/devcontainer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
"mikestead.dotenv",
3737
"me-dutour-mathieu.vscode-github-actions",
3838
"eamodio.gitlens",
39-
"GitHub.copilot"
39+
"GitHub.copilot",
40+
"GitHub.vscode-pull-request-github"
4041
]
4142
}
4243
},

CONTRIBUTING.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@ You should [operate the devcontainer out of an isolated Docker volume](https://c
1919
to avoid the _significant_ slowdowns caused by working on the host file system.
2020
You may need to [install additional software](https://code.visualstudio.com/remote/advancedcontainers/sharing-git-credentials)
2121
to share your git credentials with the container.
22-
Alternative, try using GitHub Codespaces.
22+
Alternatively, try using GitHub Codespaces.
23+
24+
If you normally [gpg sign your commits](https://code.visualstudio.com/remote/advancedcontainers/sharing-git-credentials#_sharing-gpg-keys)
25+
and the container is giving you trouble,
26+
consider turning off signing inside the container by running
27+
`git config --global commit.gpgsign false`
28+
inside the container.
2329

2430
### Dependencies
2531

cspell.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,20 @@
55
// language - current active spelling language
66
"language": "en",
77
// words - list of words to be always considered correct
8-
"words": ["cfworker", "felte", "ficsit", "pnpx", "prismjs", "smui", "tolgee", "uplugin", "urql", "webp", "wonka"],
8+
"words": [
9+
"cfworker",
10+
"felte",
11+
"ficsit",
12+
"gpgsign",
13+
"pnpx",
14+
"prismjs",
15+
"smui",
16+
"tolgee",
17+
"uplugin",
18+
"urql",
19+
"webp",
20+
"wonka"
21+
],
922
// flagWords - list of words to be always considered incorrect
1023
// This is useful for offensive words and common spelling errors.
1124
// cSpell:disable (don't complain about the words we listed here)

src/gql/mods/mod.graphql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ query GetMod($mod: String!) {
2121
}
2222
dependencies {
2323
mod_id
24+
optional
2425
condition
2526
}
2627
version
@@ -38,6 +39,7 @@ query GetMod($mod: String!) {
3839
}
3940
dependencies {
4041
mod_id
42+
optional
4143
condition
4244
}
4345
version
@@ -55,6 +57,7 @@ query GetMod($mod: String!) {
5557
}
5658
dependencies {
5759
mod_id
60+
optional
5861
condition
5962
}
6063
version

src/gql/versions/mod_version.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ query GetModVersion($version: VersionID!) {
2828
}
2929
dependencies {
3030
mod_id
31+
optional
3132
condition
3233
}
3334
}

src/lib/components/mods/ModLatestVersions.svelte

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
1010
type IVersion = Pick<Version, 'id' | 'link' | 'version' | 'created_at'> & {
1111
targets?: Pick<VersionTarget, 'targetName' | 'size' | 'hash'>[];
12-
} & { dependencies?: Pick<VersionDependency, 'mod_id' | 'condition'>[] };
12+
} & { dependencies?: Pick<VersionDependency, 'mod_id' | 'optional' | 'condition'>[] };
1313
1414
type ILatestVersions = {
1515
alpha?: IVersion;
@@ -23,6 +23,7 @@
2323
2424
export let latestVersions!: ILatestVersions;
2525
export let modId!: string;
26+
export let modReference!: string;
2627
2728
export const { t } = getTranslate();
2829
</script>
@@ -48,7 +49,7 @@
4849
<div class="text-1xl col-span-3 h-auto w-auto p-2.5">
4950
<a
5051
href="#top"
51-
on:click={() => installMod(modId)}
52+
on:click={() => installMod(modReference)}
5253
title="Install via Satisfactory Mod Manager"
5354
class="text-yellow-500">
5455
<span class="material-icons align-middle" style="font-size: 118x;">download</span> <u>Install</u>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<script lang="ts">
2+
import { base } from '$app/paths';
3+
import type { VersionDependency } from '$lib/generated';
4+
5+
export let dependency!: Pick<VersionDependency, 'mod_id' | 'optional' | 'condition'>;
6+
</script>
7+
8+
<tr class="rounded border !border-surface-500">
9+
<td>
10+
<a title="Click to view mod page" href={`${base}/mod/${dependency.mod_id}`} class="text-yellow-500">
11+
<u>{dependency.mod_id}</u>
12+
</a>
13+
</td>
14+
<td><div class="text-center">{dependency.condition}</div></td>
15+
</tr>
Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,55 @@
11
<script lang="ts">
2-
import { base } from '$app/paths';
2+
import DependencyRow from './DependencyRow.svelte';
3+
34
import type { VersionDependency } from '$lib/generated';
45
5-
export let dependencies!: Pick<VersionDependency, 'mod_id' | 'condition'>[];
6+
export let dependencies!: Pick<VersionDependency, 'mod_id' | 'optional' | 'condition'>[];
7+
8+
$: requiredDependencies = dependencies.filter((d) => !d.optional);
9+
$: optionalDependencies = dependencies.filter((d) => d.optional);
610
</script>
711

812
<div class="grid grid-flow-row">
9-
<table aria-label="Mod Dependency" class="max-w-auto table table-hover !overflow-visible">
13+
<table aria-label="Required Mod Dependencies" class="max-w-auto table table-hover !overflow-visible">
1014
<tbody>
1115
<tr class="rounded border !border-surface-500">
12-
<td>Mod Dependency</td>
16+
<td
17+
class="underline decoration-dotted"
18+
title="Other mods that must be installed for this mod to function. The Mod Manager will automatically install these for you."
19+
>Required Dependencies</td>
1320
<td><div class="text-center">Version Range</div></td>
1421
</tr>
15-
{#if dependencies?.length === 0}
22+
{#if requiredDependencies?.length === 0}
23+
<!-- A mod *not* having required dependencies is rare, so point it out when this is the case -->
1624
<tr class="rounded border !border-surface-500">
1725
<td><div class="text-center">None</div></td>
1826
<td><div class="text-center">N/A</div></td>
1927
</tr>
2028
{:else}
21-
{#each dependencies as dependency}
22-
<tr class="rounded border !border-surface-500">
23-
<td>
24-
<a title="Click to view mod page" href={`${base}/mod/${dependency.mod_id}`} class="text-yellow-500">
25-
<u>{dependency.mod_id}</u>
26-
</a>
27-
</td>
28-
<td><div class="text-center">{dependency.condition}</div></td>
29-
</tr>
29+
{#each requiredDependencies as dependency}
30+
<DependencyRow {dependency} />
3031
{/each}
3132
{/if}
3233
</tbody>
3334
</table>
3435
</div>
36+
37+
<!-- Optional dependencies are uncommon as of now, so don't spend UI space on them unless there are any -->
38+
{#if optionalDependencies?.length !== 0}
39+
<div class="grid grid-flow-row">
40+
<table aria-label="Optional Mod Dependencies" class="max-w-auto table table-hover !overflow-visible">
41+
<tbody>
42+
<tr class="rounded border !border-surface-500">
43+
<td
44+
class="underline decoration-dotted"
45+
title="Other mods that don't need to be installed for this mod to function, but may unlock additional functionality when present. You must chose to install them in the Mod Manager if you wish to use them."
46+
>Optional Dependencies</td>
47+
<td><div class="text-center">Version Range</div></td>
48+
</tr>
49+
{#each optionalDependencies as dependency}
50+
<DependencyRow {dependency} />
51+
{/each}
52+
</tbody>
53+
</table>
54+
</div>
55+
{/if}

src/routes/mod/[modId]/+page.svelte

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,10 @@
141141
modName={$mod.data.mod.name}
142142
compatibility={$mod.data.mod.compatibility} />
143143
</div>
144-
<ModLatestVersions modId={$mod.data.mod.id} latestVersions={$mod.data.mod.latestVersions} />
144+
<ModLatestVersions
145+
modId={$mod.data.mod.id}
146+
modReference={$mod.data.mod.mod_reference}
147+
latestVersions={$mod.data.mod.latestVersions} />
145148
<CompatibilityGrid compatibility={$mod.data.mod.compatibility} />
146149
<ModInfo mod={$mod.data.mod} />
147150
<ModAuthors authors={$mod.data.mod.authors} />

0 commit comments

Comments
 (0)