implemented mode change

This commit is contained in:
2024-03-25 23:23:37 +01:00
parent 45a4b58f26
commit 3f88f6b821
71 changed files with 3020 additions and 1006 deletions

View File

@ -1,7 +1,8 @@
<template>
<section v-if="hardwareBoolean && !addBool"
:class="['hardware-information', darkMode ? 'section-darkmode' : 'section-lightmode']">
<div :class="['label', darkMode ? 'div-darkmode' : 'div-lightmode']" id="hardware">Hardware specifications:</div>
<div :class="['label', darkMode ? 'div-darkmode' : 'div-lightmode']" id="hardware">Hardware specifications:
</div>
<div class="asset-data">
<div class="model-CPU">
<div class="data-field" id="model">
@ -55,7 +56,8 @@
</div>
</section>
<section v-if="addBool" :class="['hardware-information', darkMode ? 'section-darkmode' : 'section-lightmode']">
<div :class="['label', darkMode ? 'div-darkmode' : 'div-lightmode']" id="hardware">Hardware specifications:</div>
<div :class="['label', darkMode ? 'div-darkmode' : 'div-lightmode']" id="hardware">Hardware specifications:
</div>
<div class="asset-data">
<div class="model-CPU">
<div class="data-field" id="model">
@ -101,16 +103,18 @@
</div>
</section>
</template>
<script setup>
import { ref, onMounted } from 'vue';
import { ref, onMounted, watch } from 'vue';
import Axios from '../axios.config.js';
import clientsideConfig from '../../clientsideConfig.js';
import { useStore } from 'vuex';
import { computed } from 'vue';
const store = useStore();
const modeChanged = computed(() => store.state.updateDarkMode);
const editable = computed(() => store.state.editable);
const chosenAssetId = computed(() => store.state.chosenAssetId);
const addBool = computed(() => store.state.new);
@ -123,7 +127,7 @@ const newRAM = ref('');
const newStorageConfiguration = ref('');
const newMiscellaneous = ref('');
const darkMode = ref(true)
const darkMode = ref('')
const item = ref({});
const hardwareBoolean = ref(false)
@ -155,7 +159,7 @@ const updateAsset = () => {
RAM: newRAM.value,
storageConfig: newStorageConfiguration.value,
miscellaneous: newMiscellaneous.value,
};
};
store.commit('updateHardwareComponent', asset);
}
@ -204,8 +208,28 @@ const updateConfigItem = async () => {
}
}
onMounted(() => {
getItemById();
const getSession = async () => {
const loggedInUserDarkModeBool = getItem('logged-in-user-darkMode');
if (loggedInUserDarkModeBool == 1) {
darkMode.value = true;
} else {
darkMode.value = false;
}
}
function getItem(item) {
if (process.client) {
return localStorage.getItem(item)
} else {
return undefined
}
}
watch(modeChanged, getSession)
onMounted(async () => {
getSession();
await getItemById();
});
</script>
@ -213,9 +237,9 @@ onMounted(() => {
export default {
name: "HardwareSpecifications",
};
</script>
</script>
<style scoped>
.hardware-information {
display: flex;