Skip to content

Commit

Permalink
feat: target compatibility, mod dependency display (#81)
Browse files Browse the repository at this point in the history
* User-friendly display of target compatibility

Changes to solve #68

* made linter happy

* Removed unused code, corrected position of pre-dedi comment

* Lockfile for iconify, also solved lockfile fail

* Fixed implicitly has an 'any' type,

* 2x2 Target Chart/Icon, formatting wip

* Display mod dependencies as well as link to mod page

* Display mod dependencies as well as link to mod page

Solves #67

* chore: concise checkTargets function

* fix: correct download icon vertical alignment

* chore: reduce code duplication in dependency mod links

* urlWrap for source and Tag movement/formatting

* moar Tag formatting

* Removed unused packages

* Multi-target/Mod Dependency formatting

* made linter happy

* Fixed :: on Tags

* reformatted target widths

* Moved compatibility info and converted it to a Grid

* removed Multi Compability, fixed formatting

* forgot to lint, sorry

* fix: overflowing OutdatedBanner (closes #82)

* feat: compatibility icons in grid header

* chore: bash script to launch with the right env vars for dev

* chore: fix typo
it's almost a year old now, I will not allow it to have a happy birthday

* feat: compatibility grid display for mods without compatibility info specified

* feat: center mod icon on the page when displayed as a full page

* feat: compatibility grid as a card

* feat: compatibility edit button text changed "Compatibility" -> "Edit Compatibility"

* feat: mention markdown support in compatibility edit popup

* feat: extra spacing in compatibility viewing popup for improved readability

* feat: tooltips for target compatibility icons

* feat: display "(No tags assigned)" on mod page tag display when none present instead of empty space

* feat: display "(No source URL provided by mod author)" when none present instead of empty space

* feat: version target support grid as a component, now also present on View Version page

* feat: version dependencies grid as a component, now also WIP present on View Version page
...except that api endpoint doesn't return dependencies yet

* Added Multiplayer Compatibility

* lint/prettier

* Style for Multiplayer Compatbility

* Word Wrap Fixes

* Version Dependencies Grid GraphQL Fix

* Fixed some imports per Mircea's request

* Revert "Style for Multiplayer Compatbility"

This reverts commit 70f1f8d.

* Revert "lint/prettier"

This reverts commit 82af767.

* Revert "Added Multiplayer Compatibility"

This reverts commit 70db911.

* Path formatting fixes per Mircea

* Fixed formatting paths

* Removed casts, replaced with reactive version target support

* Removed WindowsNoEditor

* break-all Style => Class, removed optional ? for mod on ModInfo

* chore: remove script from 7c4ced3 since it's in its own pr now

* chore: fixes from code review

* Added VersionTarget/VersionDependency to graphql keys config

* fixed alignment of icons and text

* feat: add sml engine version

* chore: format

---------

Co-authored-by: Robb <[email protected]>
Co-authored-by: Vilsol <[email protected]>
  • Loading branch information
3 people authored Oct 19, 2023
1 parent 4b0758a commit cfe479c
Show file tree
Hide file tree
Showing 25 changed files with 310 additions and 40 deletions.
4 changes: 3 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ At the highest level you must at least have:

* [NodeJS](https://nodejs.org/en/)
* [pnpm](https://pnpm.io/)
* terminal
* terminal (Bash is suggested but not required.)

### pnpm installation

Expand Down Expand Up @@ -39,6 +39,8 @@ Now you're good to go!

## Local Development

See the [Readme](README.md) for how to point your local frontend to the staging or production API.

After you've installed everything, start the project via:

```sh
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ The `dev` script executes several processes:

* Development Server
* Svelte Checker
* GraphQL Code Generator
* ESLint

```shell
Expand Down
2 changes: 1 addition & 1 deletion cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// language - current active spelling language
"language": "en",
// words - list of words to be always considered correct
"words": ["cfworker", "felte", "prismjs", "smui", "urql", "wonka"],
"words": ["cfworker", "felte", "ficsit", "pnpx", "prismjs", "smui", "urql", "webp", "wonka"],
// flagWords - list of words to be always considered incorrect
// This is useful for offensive words and common spelling errors.
// cSpell:disable (don't complain about the words we listed here)
Expand Down
8 changes: 3 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/gql/admin/sml-versions/sml_version_admin.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ query GetSMLVersionAdmin($smlVersionID: SMLVersionID!) {
date
satisfactory_version
bootstrap_version
engine_version
}
}
1 change: 1 addition & 0 deletions src/gql/admin/sml-versions/sml_versions_admin.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ query GetSMLVersionsAdmin($filter: SMLVersionFilter) {
date
satisfactory_version
bootstrap_version
engine_version
}
count
}
Expand Down
12 changes: 12 additions & 0 deletions src/gql/mods/mod.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ query GetMod($mod: String!) {
hash
size
}
dependencies {
mod_id
condition
}
version
created_at
sml_version
Expand All @@ -32,6 +36,10 @@ query GetMod($mod: String!) {
hash
size
}
dependencies {
mod_id
condition
}
version
created_at
sml_version
Expand All @@ -45,6 +53,10 @@ query GetMod($mod: String!) {
hash
size
}
dependencies {
mod_id
condition
}
version
created_at
sml_version
Expand Down
4 changes: 4 additions & 0 deletions src/gql/versions/mod_version.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,9 @@ query GetModVersion($version: VersionID!) {
user_id
}
}
dependencies {
mod_id
condition
}
}
}
22 changes: 15 additions & 7 deletions src/lib/components/mods/ModInfo.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import { prettyDate, prettyNumber } from '$lib/utils/formatting';
import TagList from '$lib/components/utils/TagList.svelte';
import CompatibilityButton from './compatibility/CompatibilityButton.svelte';
export let mod!: Pick<
Mod,
Expand All @@ -17,16 +16,25 @@
<div class="text-lg break-words">
<h3 class="text-2xl my-4 font-bold">Info</h3>
<span
><strong>Source:</strong> <a class="underline text-yellow-500" href={mod.source_url}>{mod.source_url}</a></span
><br />
><strong>Tags:</strong>
{#if mod.tags.length == 0}
<div class="tags">(No tags assigned)</div>
{:else}
<TagList tags={mod.tags} />
{/if}
</span>
<span style="white-space: pre-line"
><strong>Source:</strong>
{#if mod.source_url}
<a class="underline text-yellow-500 break-all" href={mod.source_url}>{mod.source_url}</a>
{:else}
(No source URL provided by mod author)
{/if}
</span><br />
<span><strong>Created:</strong> {prettyDate(mod.created_at)}</span><br />
<span><strong>Views:</strong> {prettyNumber(mod.views)}</span><br />
<span><strong>Downloads:</strong> {prettyNumber(mod.downloads)}</span><br />
<span><strong>Reference:</strong> {mod.mod_reference}</span><br />
<TagList tags={mod.tags} />
{#if mod.compatibility}
<span><strong>Compatibility:</strong><CompatibilityButton compatibility={mod.compatibility} /> </span><br />
{/if}
</div>
</Content>
</Card>
22 changes: 15 additions & 7 deletions src/lib/components/mods/ModLatestVersions.svelte
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
<script lang="ts">
import type { Version } from '$lib/generated';
import { base } from '$app/paths';
import Card, { Content } from '@smui/card';
import { Icon } from '@smui/common';
import { prettyDate } from '$lib/utils/formatting';
import { installMod } from '$lib/stores/launcher';
import VersionTargetSupportGrid from '$lib/components/versions/VersionTargetSupportGrid.svelte';
import VersionDependenciesGrid from '$lib/components/versions/VersionDependenciesGrid.svelte';
import type { Version, VersionDependency, VersionTarget } from '$lib/generated';
type IVersion = Pick<Version, 'id' | 'link' | 'version' | 'created_at'> & {
targets?: Pick<VersionTarget, 'targetName' | 'size' | 'hash'>[];
} & { dependencies?: Pick<VersionDependency, 'mod_id' | 'condition'>[] };
type ILatestVersions = {
alpha?: Pick<Version, 'id' | 'link' | 'version' | 'created_at'>;
beta?: Pick<Version, 'id' | 'link' | 'version' | 'created_at'>;
release?: Pick<Version, 'id' | 'link' | 'version' | 'created_at'>;
alpha?: IVersion;
beta?: IVersion;
release?: IVersion;
};
const stabilities = {
Expand Down Expand Up @@ -38,16 +44,18 @@
>Version {latestVersions[stability].version} ({stability})</a>
<div>{prettyDate(latestVersions[stability].created_at)}</div>
</div>
<div class="text-3xl w-14 h-14 p-2.5">
<div class="text-1xl col-span-3 w-auto h-auto p-2.5">
<a
href="#top"
on:click={() => installMod(modId)}
title="Install via Satisfactory Mod Manager"
class="text-yellow-500 underline">
<Icon class="material-icons">download</Icon>
class="text-yellow-500">
<Icon class="material-icons align-middle" style="font-size: 118x;">download</Icon> <u>Download</u>
</a>
</div>
</div>
<VersionTargetSupportGrid targets={latestVersions[stability].targets} />
<VersionDependenciesGrid dependencies={latestVersions[stability].dependencies} />
{/if}
{/each}
</div>
Expand Down
6 changes: 4 additions & 2 deletions src/lib/components/mods/ModLogo.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
</script>

<div class="relative overflow-hidden">
<OutdatedBanner {compatibility} logo={true} />
<img class="rounded-lg sm:max-w-lg max-w-full w-full" src={logo} alt="Logo for {modName}" />
<div class="sm:max-w-lg max-w-full w-full">
<OutdatedBanner {compatibility} logo={true} />
<img class="rounded-lg" src={logo} alt="Logo for {modName}" />
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
</Select>
<br />
<Textfield textarea bind:value={compatibility.note} label="Note">
<HelperText slot="helper">A small description regarding the compatibility.</HelperText>
<HelperText slot="helper">A small description regarding the compatibility.<br />Markdown supported.</HelperText>
</Textfield>
96 changes: 96 additions & 0 deletions src/lib/components/mods/compatibility/CompatibilityGrid.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<script lang="ts">
import type { CompatibilityInfoInput } from '$lib/generated';
import Dialog, { Content as DialogContent, Title } from '@smui/dialog';
import Card, { Content as CardContent } from '@smui/card';
import CompatibilityInfo from '$lib/components/mods/compatibility/CompatibilityInfo.svelte';
import CompatibilityStateText from '$lib/components/mods/compatibility/CompatibilityStateText.svelte';
import Button from '@smui/button';
import DataTable, { Body, Row, Cell } from '@smui/data-table';
import { markdown } from '../../../utils/markdown';
import CompatibilityIcon from '$lib/components/mods/compatibility/CompatibilityIcon.svelte';
let open = false;
export let compatibility: CompatibilityInfoInput;
export const noNotesText = '(No extra notes)';
</script>

<Card>
<CardContent>
<div class="grid grid-flow-row gap-y-2">
<h3 class="text-2xl my-4 font-bold">Compatibility Information</h3>
<p>Click the colored text for more details.</p>
<div class="grid grid-flow-row">
<DataTable
table$aria-label="Available Releases"
class="max-w-auto"
container$class="!overflow-visible"
table$class="!overflow-visible">
<Body>
<Row>
<Cell><div class="flex justify-center items-center"><CompatibilityIcon /> Early Access</div></Cell>
<Cell
><div class="flex justify-center items-center">
<CompatibilityIcon EXP={true} /> Experimental
</div></Cell>
</Row>
<Row>
<Cell class="text-center">
<Button
--mdc-text-button-container-height="20px"
class="min-w-0 m-0"
title="Click for more information"
on:click={() => {
open = true;
}}>
<CompatibilityStateText state={compatibility?.EA?.state} />
</Button>
</Cell>
<Cell class="text-center">
<Button
--mdc-text-button-container-height="20px"
class="min-w-0 m-0"
title="Click for more information"
on:click={() => {
open = true;
}}>
<CompatibilityStateText state={compatibility?.EXP?.state} />
</Button>
</Cell>
</Row>
<Row>
<Cell>
<span style="padding: 2px; white-space:normal">
{#if compatibility?.EA?.note}
{#await markdown(compatibility.EA.note) then rendered}
{@html rendered}
{/await}
{:else}
{noNotesText}
{/if}
</span>
</Cell>
<Cell>
<span style="padding: 2px; white-space:normal">
{#if compatibility?.EXP?.note}
{#await markdown(compatibility.EXP.note) then rendered}
{@html rendered}
{/await}
{:else}
{noNotesText}
{/if}
</span>
</Cell>
</Row>
</Body>
</DataTable>
<Dialog bind:open>
<Title>Compatibility Information</Title>
<DialogContent>
<CompatibilityInfo {compatibility} />
</DialogContent>
</Dialog>
</div>
</div>
</CardContent>
</Card>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import type { CompatibilityInput } from '$lib/generated';
import { CompatibilityState } from '$lib/generated';
export let compatibility: CompatibilityInput;
export let compatibility: CompatibilityInput = null;
export let EXP = false;
let iconText = 'rocket_launch';
if (EXP) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
{/await}
</div>
{/if}
<br />
<div>Experimental: <CompatibilityStateText state={compatibility?.EXP?.state} /></div>
<div class="compatibility-state-description">
{compatibilityStateDescriptions[compatibility?.EXP?.state || 'Unknown']}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<script lang="ts">
import type { CompatibilityState } from '$lib/generated';
export let state: CompatibilityState;
export let state: CompatibilityState = null;
const classForState = (s: CompatibilityState): string => `mod-state-${s.toString().toLowerCase()}`;
const textForState = state ?? 'Unknown';
const classForState = (s: string): string => `mod-state-${s.toString().toLowerCase()}`;
</script>

<p class="{classForState(state)} mod-state">{state}</p>
<p class="{classForState(textForState)} mod-state">{textForState}</p>
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
{#if !works}
<div
class="mod-outdated-stripe"
style="max-width: inherit;"
class:mod-damaged={worst === CompatibilityState.Damaged}
class:mod-broken={worst === CompatibilityState.Broken}
class:mod-logo-outdated={logo} />
Expand Down
Loading

0 comments on commit cfe479c

Please sign in to comment.