-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from Arzte/push-zlukqzyzwtuk
Persistent Settings & Hide Disabled Addons
- Loading branch information
Showing
9 changed files
with
279 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<template> | ||
<div> | ||
<h5 class="text-center">Viewer</h5> | ||
<ul class="list-group mb-5 shadow"> | ||
<li | ||
class="list-group-item d-flex justify-content-between align-items-center" | ||
> | ||
<div class="form-check form-switch"> | ||
<input | ||
id="hideDisabledAddons" | ||
class="form-check-input me-1" | ||
type="checkbox" | ||
role="switch" | ||
:checked="disabledAddons" | ||
@change="toggleHideDisabledAddons()" | ||
/> | ||
<label class="form-check-label" for="hideDisabledAddons" | ||
>Hide Disabled Addons | ||
<small class="text-body-secondary ms-3" | ||
>When enabled hides addons whose conditions are unmet</small | ||
> | ||
</label> | ||
</div> | ||
</li> | ||
</ul> | ||
<h5 class="text-center">Backpack</h5> | ||
<ul class="list-group mb-5 shadow"> | ||
<li | ||
class="list-group-item d-flex justify-content-between align-items-center" | ||
> | ||
<div class="form-check form-switch"> | ||
<input | ||
id="showDisabledAddons" | ||
class="form-check-input me-1" | ||
type="checkbox" | ||
role="switch" | ||
:checked="disabledAddonsInBackpack" | ||
@change="toggleDisabledAddonsInBackpack()" | ||
/> | ||
<label class="form-check-label" | ||
>Show Disabled Addons | ||
<small class="text-body-secondary ms-3" | ||
>When disabled shows addons whose conditions are met</small | ||
></label | ||
> | ||
</div> | ||
</li> | ||
<li | ||
class="list-group-item d-flex justify-content-between align-items-center" | ||
> | ||
<div class="form-check form-switch"> | ||
<input | ||
id="lockBackpackObjects" | ||
class="form-check-input me-1" | ||
type="checkbox" | ||
role="switch" | ||
:checked="lockBackpackObjects" | ||
@change="toggleLockBackpackObjects()" | ||
/> | ||
<label class="form-check-label" for="lockBackpackObjects" | ||
>Lock Objects in Backpack</label | ||
> | ||
</div> | ||
</li> | ||
</ul> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { useSettingRefs, useSettingStore } from '~/composables/store/settings'; | ||
const { disabledAddons, disabledAddonsInBackpack, lockBackpackObjects } = | ||
useSettingRefs(); | ||
const { | ||
toggleHideDisabledAddons, | ||
toggleDisabledAddonsInBackpack, | ||
toggleLockBackpackObjects, | ||
} = useSettingStore(); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { defineStore, storeToRefs } from 'pinia'; | ||
|
||
export const useSettingStore = defineStore( | ||
'viewer-settings', | ||
() => { | ||
const disabledAddons = ref<boolean>(false); | ||
const disabledAddonsInBackpack = ref<boolean>(true); | ||
const lockBackpackObjects = ref<boolean>(true); | ||
|
||
const toggleHideDisabledAddons = (set?: boolean) => { | ||
disabledAddons.value = set ?? !disabledAddons.value; | ||
}; | ||
|
||
const toggleDisabledAddonsInBackpack = (set?: boolean) => { | ||
disabledAddonsInBackpack.value = set ?? !disabledAddonsInBackpack.value; | ||
}; | ||
|
||
const toggleLockBackpackObjects = (set?: boolean) => { | ||
lockBackpackObjects.value = set ?? !lockBackpackObjects.value; | ||
}; | ||
|
||
return { | ||
disabledAddons, | ||
disabledAddonsInBackpack, | ||
lockBackpackObjects, | ||
toggleLockBackpackObjects, | ||
toggleDisabledAddonsInBackpack, | ||
toggleHideDisabledAddons, | ||
}; | ||
}, | ||
{ | ||
persist: { | ||
storage: piniaPluginPersistedstate.localStorage(), | ||
}, | ||
}, | ||
); | ||
|
||
export const useSettingRefs = () => storeToRefs(useSettingStore()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.