Skip to content

Commit

Permalink
chore: remove references to deprecated sml_version field
Browse files Browse the repository at this point in the history
  • Loading branch information
mircearoata committed Aug 11, 2024
1 parent efc0377 commit a66ac66
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 28 deletions.
3 changes: 0 additions & 3 deletions src/gql/home/mods.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,14 @@ query GetMods($offset: Int!, $limit: Int!, $search: String, $order: Order, $orde
alpha {
id
version
sml_version
}
beta {
id
version
sml_version
}
release {
id
version
sml_version
}
}
compatibility {
Expand Down
3 changes: 0 additions & 3 deletions src/gql/mods/mod.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ query GetMod($mod: String!) {
}
version
created_at
sml_version
game_version
}
beta {
Expand All @@ -43,7 +42,6 @@ query GetMod($mod: String!) {
}
version
created_at
sml_version
game_version
}
release {
Expand All @@ -61,7 +59,6 @@ query GetMod($mod: String!) {
}
version
created_at
sml_version
game_version
}
}
Expand Down
1 change: 0 additions & 1 deletion src/gql/mods/versions.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ query GetModVersions($mod: ModID!, $limit: Int!, $offset: Int!) {
id
version
stability
sml_version
game_version
downloads
created_at
Expand Down
3 changes: 0 additions & 3 deletions src/gql/users/user.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,14 @@ query GetUser($user: UserID!) {
alpha {
id
version
sml_version
}
beta {
id
version
sml_version
}
release {
id
version
sml_version
}
}
compatibility {
Expand Down
1 change: 0 additions & 1 deletion src/gql/versions/mod_version.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ query GetModVersion($version: VersionID!) {
id
version
stability
sml_version
game_version
downloads
created_at
Expand Down
6 changes: 3 additions & 3 deletions src/lib/components/mods/ModCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
'id' | 'mod_reference' | 'name' | 'logo' | 'views' | 'downloads' | 'short_description' | 'compatibility' | 'tags'
> & {
latestVersions: {
alpha?: Maybe<Pick<Version, 'id' | 'sml_version'>>;
beta?: Maybe<Pick<Version, 'id' | 'sml_version'>>;
release?: Maybe<Pick<Version, 'id' | 'sml_version'>>;
alpha?: Maybe<Pick<Version, 'id'>>;
beta?: Maybe<Pick<Version, 'id'>>;
release?: Maybe<Pick<Version, 'id'>>;
};
};
Expand Down
4 changes: 1 addition & 3 deletions src/lib/components/mods/ModVersions.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
<tr>
<th>{$t('version')}</th>
<th>{$t('stability')}</th>
<th>SML {$t('version')}</th>
<th>{$t('game-versions')}</th>
<th>{$t('downloads')}</th>
<th>{$t('upload-date')}</th>
Expand All @@ -62,7 +61,6 @@
<tr on:click={() => toggleRow(version.id)}>
<td>{version.version}</td>
<td>{version.stability}</td>
<td>{version.sml_version}</td>
<td>{version.game_version}</td>
<td>{prettyNumber(version.downloads)}</td>
<td>{prettyDate(version.created_at)}</td>
Expand Down Expand Up @@ -141,7 +139,7 @@

{#if expandedVersions.has(version.id)}
<tr>
<td colspan={7}>
<td colspan={6}>
<div class="col-span-3 p-2">{$t('size')}: {prettyBytes(version.size)}</div>
<div class="col-span-3 p-2">{$t('hash')}: {version.hash}</div>

Expand Down
6 changes: 1 addition & 5 deletions src/lib/components/versions/VersionInfo.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
import { prettyBytes, prettyDate, prettyNumber } from '$lib/utils/formatting';
import { getTranslate } from '@tolgee/svelte';
export let version!: Pick<
Version,
'created_at' | 'sml_version' | 'game_version' | 'size' | 'stability' | 'downloads' | 'hash'
>;
export let version!: Pick<Version, 'created_at' | 'game_version' | 'size' | 'stability' | 'downloads' | 'hash'>;
export const { t } = getTranslate();
</script>
Expand All @@ -17,7 +14,6 @@
<h3 class="my-4 text-2xl font-bold">Info</h3>
<span><strong>{$t('entry.created-at')}:</strong> {prettyDate(version.created_at)}</span><br />
<span><strong>{$t('downloads')}:</strong> {prettyNumber(version.downloads)}</span><br />
<span><strong>SML {$t('version')}:</strong> {version.sml_version}</span><br />
<span><strong>{$t('game-versions')}:</strong> {version.game_version}</span><br />
<span><strong>{$t('stability')}:</strong> {version.stability}</span><br />
<span><strong>{$t('size')}:</strong> {prettyBytes(version.size)}</span><br />
Expand Down
12 changes: 6 additions & 6 deletions src/lib/utils/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import minVersion from 'semver/ranges/min-version.js';
import type { Maybe, Version } from '$lib/generated';

export const modStatus = (latestVersions?: {
alpha?: Maybe<Pick<Version, 'sml_version'>>;
beta?: Maybe<Pick<Version, 'sml_version'>>;
release?: Maybe<Pick<Version, 'sml_version'>>;
alpha?: Maybe<Pick<Version, 'game_version'>>;
beta?: Maybe<Pick<Version, 'game_version'>>;
release?: Maybe<Pick<Version, 'game_version'>>;
}) => {
if (!latestVersions) {
return 'outdated';
Expand All @@ -14,10 +14,10 @@ export const modStatus = (latestVersions?: {
let result: 'outdated' | 'own-risk' = 'outdated';
for (const releaseType of Object.keys(latestVersions)) {
const version = latestVersions[releaseType];
if (version && version.sml_version) {
if (version && version.game_version) {
try {
if (satisfies(minVersion(version.sml_version), '>=3.0.0')) {
if (satisfies(minVersion(version.sml_version), '>=3.2.0')) {
if (satisfies(minVersion(version.game_version), '>=150216')) {
if (satisfies(minVersion(version.game_version), '>=173618')) {
return undefined;
}
result = 'own-risk';
Expand Down

0 comments on commit a66ac66

Please sign in to comment.