-
Notifications
You must be signed in to change notification settings - Fork 311
feat(frontend): Store last selected game version and platform for download modal #3284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
1df25ee
9fdac5a
7ca23e7
30a567b
e820844
8b3d426
91a4301
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -244,22 +244,7 @@ | |
</div> | ||
|
||
<div class="mx-auto flex w-fit flex-col gap-2"> | ||
<ButtonStyled v-if="project.game_versions.length === 1"> | ||
<div class="disabled button-like"> | ||
<GameIcon aria-hidden="true" /> | ||
{{ | ||
currentGameVersion | ||
? `Game version: ${currentGameVersion}` | ||
: "Error: no game versions found" | ||
}} | ||
<InfoIcon | ||
v-tooltip="`${project.title} is only available for ${currentGameVersion}`" | ||
class="ml-auto size-5" | ||
/> | ||
</div> | ||
</ButtonStyled> | ||
<Accordion | ||
v-else | ||
ref="gameVersionAccordion" | ||
class="accordion-with-bg" | ||
@on-open=" | ||
|
@@ -313,7 +298,7 @@ | |
}" | ||
@click=" | ||
() => { | ||
userSelectedGameVersion = gameVersion; | ||
setSelectedGameVersion(gameVersion); | ||
gameVersionAccordion.close(); | ||
if (!currentPlatform && platformAccordion) { | ||
platformAccordion.open(); | ||
|
@@ -341,26 +326,8 @@ | |
:disabled="!!versionFilter" | ||
/> | ||
</Accordion> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, why was this removed? |
||
<ButtonStyled | ||
v-if="project.loaders.length === 1 && project.project_type !== 'resourcepack'" | ||
> | ||
<div class="disabled button-like"> | ||
<WrenchIcon aria-hidden="true" /> | ||
{{ | ||
currentPlatform | ||
? `Platform: ${formatCategory(currentPlatform)}` | ||
: "Error: no platforms found" | ||
}} | ||
<InfoIcon | ||
v-tooltip=" | ||
`${project.title} is only available for ${formatCategory(currentPlatform)}` | ||
" | ||
class="ml-auto size-5" | ||
/> | ||
</div> | ||
</ButtonStyled> | ||
<Accordion | ||
v-else-if="project.project_type !== 'resourcepack'" | ||
v-if="project.project_type !== 'resourcepack'" | ||
ref="platformAccordion" | ||
class="accordion-with-bg" | ||
@on-open=" | ||
|
@@ -396,7 +363,7 @@ | |
}" | ||
@click=" | ||
() => { | ||
userSelectedPlatform = platform; | ||
setSelectedPlatform(platform); | ||
|
||
platformAccordion.close(); | ||
if (!currentGameVersion && gameVersionAccordion) { | ||
|
@@ -915,7 +882,6 @@ import { | |
ImageIcon as GalleryIcon, | ||
GameIcon, | ||
HeartIcon, | ||
InfoIcon, | ||
LinkIcon as LinksIcon, | ||
MoreVerticalIcon, | ||
PlusIcon, | ||
|
@@ -992,6 +958,10 @@ const overTheTopDownloadAnimation = ref(); | |
const userSelectedGameVersion = ref(null); | ||
const userSelectedPlatform = ref(null); | ||
const showAllVersions = ref(false); | ||
if (import.meta.client) { | ||
userSelectedGameVersion.value = localStorage.getItem("selected_game_version"); | ||
userSelectedPlatform.value = localStorage.getItem("selected_platform"); | ||
} | ||
|
||
const gameVersionFilterInput = ref(); | ||
|
||
|
@@ -1090,7 +1060,18 @@ const licenseIdDisplay = computed(() => { | |
return id; | ||
} | ||
}); | ||
|
||
function setSelectedGameVersion(version) { | ||
denisJaved marked this conversation as resolved.
Show resolved
Hide resolved
|
||
userSelectedGameVersion.value = version; | ||
if (import.meta.client) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rather than actually calling localStorage, it might be best to use Also, make sure that it correctly falls back to undefined/not set if the local storage game version isn't actually supported by the project. |
||
localStorage.setItem("selected_game_version", version); | ||
} | ||
} | ||
function setSelectedPlatform(platform) { | ||
userSelectedPlatform.value = platform; | ||
if (import.meta.client) { | ||
localStorage.setItem("selected_platform", platform); | ||
} | ||
} | ||
async function getLicenseData(event) { | ||
modalLicense.value.show(event); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this removed? "Error: no game versions found"