Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ You may also need to manually run the frontend linter. First, navigate to the `f

```bash
pnpm run format
pnpm run check
```

### Assorted Development Helpers
Expand Down
3 changes: 3 additions & 0 deletions frontend/pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
onlyBuiltDependencies:
- esbuild
- svelte-preprocess
22 changes: 17 additions & 5 deletions frontend/src/lib/components/left-bar/Settings.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import { languages } from '$lib/localization';
import { type PopupSettings, getModalStore, popup } from '$lib/skeletonExtensions';
import { addQueuedModAction, hasPendingProfileChange, queuedMods } from '$lib/store/actionQueue';
import { lockfileMods, manifestMods } from '$lib/store/ficsitCLIStore';
import { lockfileMods } from '$lib/store/ficsitCLIStore';
import { error } from '$lib/store/generalStore';
import {
debug,
Expand Down Expand Up @@ -148,7 +148,7 @@

async function copyModList() {
// Generate mod entries
const modList = await Promise.all(Object.keys($manifestMods).map(async (modReference) => {
const modList = (await Promise.all(Object.keys($lockfileMods).map(async (modReference) => {
let modName = modReference;
if($offline) {
modName = (await OfflineGetMod(modReference)).name;
Expand All @@ -158,12 +158,13 @@
modName = result.data.getModByReference.name;
}
}

return {
friendlyName: modName,
modReference,
version: $lockfileMods[modReference].version,
};
}));
})));
// Sort by Friendly Name
modList.sort((a, b) => {
const x = a.friendlyName.toLowerCase();
Expand All @@ -180,14 +181,20 @@
mod.modReference = mod.modReference.padEnd(maxModReferenceLen, ' ');
modListString += `${mod.friendlyName} ${mod.modReference} ${mod.version}\n`;
});
navigator.clipboard.writeText(modListString.trim());
const markdownCodeblockFence = '```';
navigator.clipboard.writeText(`${markdownCodeblockFence}\n${modListString.trim()}\n${markdownCodeblockFence}`);
}

function localeName(locale: string) {
if (!locale) return 'N/A';
return new Intl.DisplayNames([locale], { type: 'language' }).of(locale);
}

// appease svelte "stores must be declared at the top of the file"
function displayError(err: string) {
$error = err;
}

$: if ($queueAutoStart && $queuedMods.length === 0 && $hasPendingProfileChange) {
$hasPendingProfileChange = false;
addQueuedModAction('__apply__', 'apply', Apply).catch((e) => error.set(e));
Expand Down Expand Up @@ -336,7 +343,12 @@
</li>
<hr class="divider" />
<li>
<button on:click={() => copyModList()}>
<button
on:click={() => {
copyModList().catch((error) => {
displayError(`failed to copy mod list: ${error}`);
});
}}>
<span class="h-5 w-5"/>
<span class="flex-auto">
<T defaultValue="Copy mod list" keyName="settings.copy-mod-list"/>
Expand Down