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
39 changes: 37 additions & 2 deletions web/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,42 @@
"error_no_mod_added": "No mod was added, can't process if you haven't any mod",
"processing_modpack_creator": "Processing...",
"error_while_calculating": "Error while processing",
"result": "Results",
"show_raw_data": "Show Raw Data"
"remaining_results": "{nb_remaining} other possibilities",
"results": {
"compatible_mods": "Compatible mods",
"best_config": "Best Minecraft configuration",
"mc_version": [
{
"declarations": ["input count", "local countPlural = count: plural"],
"selectors": ["countPlural"],
"match": {
"countPlural=one": "Minecraft version",
"countPlural=other": "Minecraft versions"
}
}
],
"loader": [
{
"declarations": ["input count", "local countPlural = count: plural"],
"selectors": ["countPlural"],
"match": {
"countPlural=one": "Loader",
"countPlural=other": "Loaders"
}
}
],
"download": "Download",
"download_all": [
{
"declarations": ["input count", "local countPlural = count: plural"],
"selectors": ["countPlural"],
"match": {
"countPlural=one": "Download the mod",
"countPlural=other": "Download all mods"
}
}
]
},
"log_raw_data": "Log raw data in dev tools"
}
}
39 changes: 37 additions & 2 deletions web/messages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,42 @@
"error_no_mod_added": "Aucun mod n'a été ajouté, exécution impossible s'il n'y a pas de mod",
"processing_modpack_creator": "Calcul...",
"error_while_calculating": "Erreur pendant processus",
"result": "Résultats",
"show_raw_data": "Afficher les données brutes"
"remaining_results": "{nb_remaining} autres possibilités",
"results": {
"compatible_mods": "Mods compatibles",
"best_config": "Meilleure configuration Minecraft",
"mc_version": [
{
"declarations": ["input count", "local countPlural = count: plural"],
"selectors": ["countPlural"],
"match": {
"countPlural=one": "Version Minecraft",
"countPlural=other": "Versions Minecraft"
}
}
],
"loader": [
{
"declarations": ["input count", "local countPlural = count: plural"],
"selectors": ["countPlural"],
"match": {
"countPlural=one": "Loader",
"countPlural=other": "Loaders"
}
}
],
"download": "Télécharger",
"download_all": [
{
"declarations": ["input count", "local countPlural = count: plural"],
"selectors": ["countPlural"],
"match": {
"countPlural=one": "Télécharger le mod",
"countPlural=other": "Télécharger tous les mods"
}
}
]
},
"log_raw_data": "Afficher les données brutes dans les outils de développeur"
}
}
2 changes: 1 addition & 1 deletion web/src/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
%sveltekit.body%
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>
3 changes: 3 additions & 0 deletions web/src/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ export { default as ModsList } from './components/ModsList.svelte';
export { default as ToggleButtons } from './components/ToggleButtons.svelte';
export { default as FileDropZone } from './components/FileDropZone.svelte';
export { default as MCVersionSelection } from './components/MCVersionSelection.svelte';
export { default as ReleasesResult } from './components/ReleasesResult.svelte';
export { default as ModResultsList } from './components/ModResultsList.svelte';
export { default as ReleasesResultCarousel } from './components/ReleaseResultCarousel.svelte';
119 changes: 119 additions & 0 deletions web/src/components/ModResultsList.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
<script lang="ts">
import type { ModRepoRelease } from 'mclib';
import { m } from '$msg';

let { mod_list }: { mod_list: ModRepoRelease[] } = $props();

const delay = (milliseconds: number) =>
new Promise((resolve) => {
setTimeout(resolve, milliseconds);
});

async function download_all(urls: string[]) {
for (const [index, url] of urls.entries()) {
await delay(index * 100);
const a = document.createElement('a');
a.style.display = 'none';
a.href = url;
document.body.append(a);
a.click();
await delay(100);
a.remove();
}
}
</script>

<ul id="mods_list">
{#each mod_list as mod (mod)}
<li>
<img
src={mod.modMetadata ? mod.modMetadata.imageURL : ''}
alt={mod.modMetadata ? mod.modMetadata.name : 'mod' + ' picture'}
/>
<div class="infos">
<p>
<a href={mod.modMetadata?.homepageURL}
><b>{mod.modMetadata ? mod.modMetadata.name : 'mod'}</b></a
>
({mod.modVersion})
</p>
<p>
{m['runner.results.mc_version']({ count: mod.mcVersions.size })}: {Array.from(
mod.mcVersions
).join(', ')}
</p>
<p>
{m['runner.results.loader']({ count: mod.loaders.size })}: {Array.from(mod.loaders).join(
', '
)}
</p>
</div>
<div class="actions">
<a href={mod.downloadUrl}>{m['runner.results.download']()}</a>
</div>
</li>
{/each}
</ul>
<button
onclick={(event) => {
event.preventDefault();
download_all(
mod_list.map((mod) => {
return mod.downloadUrl;
})
);
}}>{m['runner.results.download_all']({ count: mod_list.length })}</button
>

<style>
#mods_list {
display: flex;
flex-direction: column;
gap: 0.5rem;
padding: 0.5rem;
border: solid 2px var(--green);
background: var(--grey-dark-1);
overflow-y: scroll;
max-height: 32rem;
& li {
display: flex;
flex-direction: row;
justify-content: space-between;
gap: 1rem;
align-items: center;
background: var(--grey-dark-2);
padding: 0.5rem;
& img {
width: 48px;
height: 48px;
}
& .infos {
flex: 1;
display: flex;
flex-direction: column;
align-items: start;
}
& .actions {
display: flex;
flex-direction: row;
align-items: center;
gap: 0.5rem;
}
}
}
button {
width: 100%;
text-align: center;
padding: 0.4rem 0.6rem;
outline: none;
border: solid var(--green);
border-width: 2px;
user-select: none;
background-color: var(--green);
font-size: 16px;
color: var(--grey-dark-2);
&:is(:active, :hover) {
border-color: var(--green-light-1);
}
}
</style>
Loading