mirror of
https://forgejo.merr.is/annika/isl-vue3.git
synced 2025-12-14 10:29:04 -05:00
Initial commit...
This commit is contained in:
commit
44fad476d2
40 changed files with 1279 additions and 0 deletions
18
src/App.vue
Normal file
18
src/App.vue
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<script setup lang="ts">
|
||||
import { RouterView } from 'vue-router'
|
||||
import GlobalHeader from '@/components/GlobalHeader.vue'
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-app>
|
||||
<GlobalHeader />
|
||||
<v-main>
|
||||
<RouterView />
|
||||
</v-main>
|
||||
<v-footer>
|
||||
<div>The footer goes here</div>
|
||||
</v-footer>
|
||||
</v-app>
|
||||
</template>
|
||||
|
||||
<style></style>
|
||||
86
src/assets/base.css
Normal file
86
src/assets/base.css
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
/* color palette from <https://github.com/vuejs/theme> */
|
||||
:root {
|
||||
--vt-c-white: #ffffff;
|
||||
--vt-c-white-soft: #f8f8f8;
|
||||
--vt-c-white-mute: #f2f2f2;
|
||||
|
||||
--vt-c-black: #181818;
|
||||
--vt-c-black-soft: #222222;
|
||||
--vt-c-black-mute: #282828;
|
||||
|
||||
--vt-c-indigo: #2c3e50;
|
||||
|
||||
--vt-c-divider-light-1: rgba(60, 60, 60, 0.29);
|
||||
--vt-c-divider-light-2: rgba(60, 60, 60, 0.12);
|
||||
--vt-c-divider-dark-1: rgba(84, 84, 84, 0.65);
|
||||
--vt-c-divider-dark-2: rgba(84, 84, 84, 0.48);
|
||||
|
||||
--vt-c-text-light-1: var(--vt-c-indigo);
|
||||
--vt-c-text-light-2: rgba(60, 60, 60, 0.66);
|
||||
--vt-c-text-dark-1: var(--vt-c-white);
|
||||
--vt-c-text-dark-2: rgba(235, 235, 235, 0.64);
|
||||
}
|
||||
|
||||
/* semantic color variables for this project */
|
||||
:root {
|
||||
--color-background: var(--vt-c-white);
|
||||
--color-background-soft: var(--vt-c-white-soft);
|
||||
--color-background-mute: var(--vt-c-white-mute);
|
||||
|
||||
--color-border: var(--vt-c-divider-light-2);
|
||||
--color-border-hover: var(--vt-c-divider-light-1);
|
||||
|
||||
--color-heading: var(--vt-c-text-light-1);
|
||||
--color-text: var(--vt-c-text-light-1);
|
||||
|
||||
--section-gap: 160px;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--color-background: var(--vt-c-black);
|
||||
--color-background-soft: var(--vt-c-black-soft);
|
||||
--color-background-mute: var(--vt-c-black-mute);
|
||||
|
||||
--color-border: var(--vt-c-divider-dark-2);
|
||||
--color-border-hover: var(--vt-c-divider-dark-1);
|
||||
|
||||
--color-heading: var(--vt-c-text-dark-1);
|
||||
--color-text: var(--vt-c-text-dark-2);
|
||||
}
|
||||
}
|
||||
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
body {
|
||||
min-height: 100vh;
|
||||
color: var(--color-text);
|
||||
background: var(--color-background);
|
||||
transition:
|
||||
color 0.5s,
|
||||
background-color 0.5s;
|
||||
line-height: 1.6;
|
||||
font-family:
|
||||
Inter,
|
||||
-apple-system,
|
||||
BlinkMacSystemFont,
|
||||
'Segoe UI',
|
||||
Roboto,
|
||||
Oxygen,
|
||||
Ubuntu,
|
||||
Cantarell,
|
||||
'Fira Sans',
|
||||
'Droid Sans',
|
||||
'Helvetica Neue',
|
||||
sans-serif;
|
||||
font-size: 15px;
|
||||
text-rendering: optimizeLegibility;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
1
src/assets/logo.svg
Normal file
1
src/assets/logo.svg
Normal file
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 261.76 226.69"><path d="M161.096.001l-30.225 52.351L100.647.001H-.005l130.877 226.688L261.749.001z" fill="#41b883"/><path d="M161.096.001l-30.225 52.351L100.647.001H52.346l78.526 136.01L209.398.001z" fill="#34495e"/></svg>
|
||||
|
After Width: | Height: | Size: 276 B |
31
src/assets/main.css
Normal file
31
src/assets/main.css
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
@import './base.css';
|
||||
|
||||
#app {
|
||||
margin: 0 auto;
|
||||
padding: 2rem;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
a,
|
||||
.green {
|
||||
text-decoration: none;
|
||||
color: hsla(160, 100%, 37%, 1);
|
||||
transition: 0.4s;
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
@media (hover: hover) {
|
||||
a:hover {
|
||||
background-color: hsla(160, 100%, 37%, 0.2);
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
body {
|
||||
place-items: center;
|
||||
}
|
||||
|
||||
#app {
|
||||
padding: 0 2rem;
|
||||
}
|
||||
}
|
||||
55
src/components/BlessingPower/SpecialItemsCard.vue
Normal file
55
src/components/BlessingPower/SpecialItemsCard.vue
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<script setup lang="ts">
|
||||
import { usePowerItems } from '@/stores/powerItems'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import SpecialItem from '@/components/SpecialItem.vue'
|
||||
|
||||
const { specialBlessingItems, specialBlessingItemsMinTotal, specialBlessingItemsMaxTotal, specialBlessingItemsAveTotal } =
|
||||
storeToRefs(usePowerItems())
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-card fluid>
|
||||
<v-card-title>Special Items</v-card-title>
|
||||
<v-card-subtitle>Items that exist all the time</v-card-subtitle>
|
||||
<v-card-item>
|
||||
<v-table density="compact">
|
||||
<thead>
|
||||
<tr>
|
||||
<!-- <th></th> -->
|
||||
<th class="text-left font-weight-bold">Name</th>
|
||||
<th class="text-left font-weight-bold">Min. Power</th>
|
||||
<th class="text-left font-weight-bold">Max. Power</th>
|
||||
<th class="text-left font-weight-bold">Owned</th>
|
||||
<th class="text-right font-weight-bold">Min. Total</th>
|
||||
<th class="text-right font-weight-bold">Max. Total</th>
|
||||
<th class="text-right font-weight-bold">Ave. Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<SpecialItem
|
||||
v-for="[key, item] in specialBlessingItems"
|
||||
:key="key"
|
||||
:itemID="key"
|
||||
:itemName="item.itemName"
|
||||
:itemIcon="'none'"
|
||||
:owned="item.owned"
|
||||
:minPower="item.minItemPower"
|
||||
:maxPower="item.maxItemPower"
|
||||
/>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<!-- <td></td> -->
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td class="px-0 text-right font-weight-bold">{{ specialBlessingItemsMinTotal }}</td>
|
||||
<td class="px-0 text-right font-weight-bold">{{ specialBlessingItemsMaxTotal }}</td>
|
||||
<td class="px-0 text-right font-weight-bold">{{ specialBlessingItemsAveTotal }}</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</v-table>
|
||||
</v-card-item>
|
||||
</v-card>
|
||||
</template>
|
||||
48
src/components/BlessingPower/StandardItemsCard.vue
Normal file
48
src/components/BlessingPower/StandardItemsCard.vue
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
<script setup lang="ts">
|
||||
import { usePowerItems } from '@/stores/powerItems'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import StandardItem from '@/components/StandardItem.vue'
|
||||
|
||||
const { standardBlessingItems, standardBlessingItemTotal } = storeToRefs(usePowerItems())
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-card>
|
||||
<v-card-title>Standard Items</v-card-title>
|
||||
<v-card-subtitle>Items that exist all the time</v-card-subtitle>
|
||||
<v-card-item>
|
||||
<v-table density="compact">
|
||||
<thead>
|
||||
<tr>
|
||||
<!-- <th></th> -->
|
||||
<th class="text-left font-weight-bold">Name</th>
|
||||
<th class="text-left font-weight-bold">Power</th>
|
||||
<th class="text-left font-weight-bold">Owned</th>
|
||||
<th class="text-right font-weight-bold">Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<StandardItem
|
||||
v-for="[key, item] in standardBlessingItems"
|
||||
:key="key"
|
||||
:itemID="key"
|
||||
:itemName="item.itemName"
|
||||
:itemIcon="'none'"
|
||||
:owned="item.owned"
|
||||
:minPower="item.minItemPower"
|
||||
:maxPower="item.maxItemPower"
|
||||
/>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<!-- <td></td> -->
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td class="px-0 text-right font-weight-bold">{{ standardBlessingItemTotal }}</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</v-table>
|
||||
</v-card-item>
|
||||
</v-card>
|
||||
</template>
|
||||
30
src/components/BlessingPower/SummaryCard.vue
Normal file
30
src/components/BlessingPower/SummaryCard.vue
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<script setup lang="ts">
|
||||
import { usePowerItems } from '@/stores/powerItems';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { computed } from 'vue';
|
||||
|
||||
const { standardBlessingItemTotal, specialBlessingItemsMinTotal, specialBlessingItemsMaxTotal, specialBlessingItemsAveTotal} = storeToRefs(usePowerItems())
|
||||
|
||||
const minIncrease = computed(() => standardBlessingItemTotal.value + specialBlessingItemsMinTotal.value)
|
||||
const maxIncrease = computed(() => standardBlessingItemTotal.value + specialBlessingItemsMaxTotal.value)
|
||||
const aveIncrease = computed(() => standardBlessingItemTotal.value + specialBlessingItemsAveTotal.value)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-card>
|
||||
<v-card-title>Overall Blessing Power Increase</v-card-title>
|
||||
<v-card-item>
|
||||
<v-list density="compact">
|
||||
<v-list-item>
|
||||
<v-list-item-title>Minimum: {{ minIncrease }}</v-list-item-title>
|
||||
</v-list-item>
|
||||
<v-list-item>
|
||||
<v-list-item-title>Maximum: {{ maxIncrease }}</v-list-item-title>
|
||||
</v-list-item>
|
||||
<v-list-item>
|
||||
<v-list-item-title>Mean: {{ aveIncrease }}</v-list-item-title>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-card-item>
|
||||
</v-card>
|
||||
</template>
|
||||
55
src/components/FellowPower/SpecialItemsCard.vue
Normal file
55
src/components/FellowPower/SpecialItemsCard.vue
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<script setup lang="ts">
|
||||
import { usePowerItems } from '@/stores/powerItems'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import SpecialItem from '@/components/SpecialItem.vue'
|
||||
|
||||
const { specialFellowItems, specialFellowItemsMinTotal, specialFellowItemsMaxTotal, specialFellowItemsAveTotal } =
|
||||
storeToRefs(usePowerItems())
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-card fluid>
|
||||
<v-card-title>Special Items</v-card-title>
|
||||
<v-card-subtitle>Items that exist all the time</v-card-subtitle>
|
||||
<v-card-item>
|
||||
<v-table density="compact">
|
||||
<thead>
|
||||
<tr>
|
||||
<!-- <th></th> -->
|
||||
<th class="text-left font-weight-bold">Name</th>
|
||||
<th class="text-left font-weight-bold">Min. Power</th>
|
||||
<th class="text-left font-weight-bold">Max. Power</th>
|
||||
<th class="text-left font-weight-bold">Owned</th>
|
||||
<th class="text-right font-weight-bold">Min. Total</th>
|
||||
<th class="text-right font-weight-bold">Max. Total</th>
|
||||
<th class="text-right font-weight-bold">Ave. Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<SpecialItem
|
||||
v-for="[key, item] in specialFellowItems"
|
||||
:key="key"
|
||||
:itemID="key"
|
||||
:itemName="item.itemName"
|
||||
:itemIcon="'none'"
|
||||
:owned="item.owned"
|
||||
:minPower="item.minItemPower"
|
||||
:maxPower="item.maxItemPower"
|
||||
/>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<!-- <td></td> -->
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td class="px-0 text-right font-weight-bold">{{ specialFellowItemsMinTotal }}</td>
|
||||
<td class="px-0 text-right font-weight-bold">{{ specialFellowItemsMaxTotal }}</td>
|
||||
<td class="px-0 text-right font-weight-bold">{{ specialFellowItemsAveTotal }}</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</v-table>
|
||||
</v-card-item>
|
||||
</v-card>
|
||||
</template>
|
||||
48
src/components/FellowPower/StandardItemsCard.vue
Normal file
48
src/components/FellowPower/StandardItemsCard.vue
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
<script setup lang="ts">
|
||||
import { usePowerItems } from '@/stores/powerItems'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import StandardItem from '@/components/StandardItem.vue'
|
||||
|
||||
const { standardFellowItems, standardFellowItemTotal } = storeToRefs(usePowerItems())
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-card>
|
||||
<v-card-title>Standard Items</v-card-title>
|
||||
<v-card-subtitle>Items that exist all the time</v-card-subtitle>
|
||||
<v-card-item>
|
||||
<v-table density="compact">
|
||||
<thead>
|
||||
<tr>
|
||||
<!-- <th></th> -->
|
||||
<th class="text-left font-weight-bold">Name</th>
|
||||
<th class="text-left font-weight-bold">Power</th>
|
||||
<th class="text-left font-weight-bold">Owned</th>
|
||||
<th class="text-right font-weight-bold">Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<StandardItem
|
||||
v-for="[key, item] in standardFellowItems"
|
||||
:key="key"
|
||||
:itemID="key"
|
||||
:itemName="item.itemName"
|
||||
:itemIcon="'none'"
|
||||
:owned="item.owned"
|
||||
:minPower="item.minItemPower"
|
||||
:maxPower="item.maxItemPower"
|
||||
/>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<!-- <td></td> -->
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td class="px-0 text-right font-weight-bold">{{ standardFellowItemTotal }}</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</v-table>
|
||||
</v-card-item>
|
||||
</v-card>
|
||||
</template>
|
||||
30
src/components/FellowPower/SummaryCard.vue
Normal file
30
src/components/FellowPower/SummaryCard.vue
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<script setup lang="ts">
|
||||
import { usePowerItems } from '@/stores/powerItems';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { computed } from 'vue';
|
||||
|
||||
const { standardFellowItemTotal, specialFellowItemsMinTotal, specialFellowItemsMaxTotal, specialFellowItemsAveTotal} = storeToRefs(usePowerItems())
|
||||
|
||||
const minIncrease = computed(() => standardFellowItemTotal.value + specialFellowItemsMinTotal.value)
|
||||
const maxIncrease = computed(() => standardFellowItemTotal.value + specialFellowItemsMaxTotal.value)
|
||||
const aveIncrease = computed(() => standardFellowItemTotal.value + specialFellowItemsAveTotal.value)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-card>
|
||||
<v-card-title>Overall Fellow Power Increase</v-card-title>
|
||||
<v-card-item>
|
||||
<v-list density="compact">
|
||||
<v-list-item>
|
||||
<v-list-item-title>Minimum: {{ minIncrease }}</v-list-item-title>
|
||||
</v-list-item>
|
||||
<v-list-item>
|
||||
<v-list-item-title>Maximum: {{ maxIncrease }}</v-list-item-title>
|
||||
</v-list-item>
|
||||
<v-list-item>
|
||||
<v-list-item-title>Mean: {{ aveIncrease }}</v-list-item-title>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-card-item>
|
||||
</v-card>
|
||||
</template>
|
||||
7
src/components/GlobalHeader.vue
Normal file
7
src/components/GlobalHeader.vue
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<script setup lang="ts"></script>
|
||||
|
||||
<template>
|
||||
<v-app-bar color="pink-lighten-3" scroll-behavior="elevate">
|
||||
<v-app-bar-title>Isekai Slow Life Calculator</v-app-bar-title>
|
||||
</v-app-bar>
|
||||
</template>
|
||||
40
src/components/SpecialItem.vue
Normal file
40
src/components/SpecialItem.vue
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { computed } from 'vue';
|
||||
import { usePowerItems } from '@/stores/powerItems'
|
||||
|
||||
interface Props {
|
||||
itemID: string
|
||||
itemName: string
|
||||
itemIcon: string
|
||||
owned: number
|
||||
minPower: number
|
||||
maxPower: number
|
||||
}
|
||||
|
||||
const props = defineProps<Props>()
|
||||
const itemsOwned = ref(props.owned)
|
||||
const { updateOwned } = usePowerItems()
|
||||
|
||||
const minTotalValue = computed(() => itemsOwned.value * props.minPower)
|
||||
const maxTotalValue = computed(() => itemsOwned.value * props.maxPower)
|
||||
const aveTotalValue = computed(() => itemsOwned.value * ((props.minPower + props.maxPower) / 2))
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<tr>
|
||||
<!-- <td>ICON</td> -->
|
||||
<td class="text-left">{{ props.itemName }}</td>
|
||||
<td class="text-right">{{ props.minPower }}</td>
|
||||
<td class="text-right">{{ props.maxPower }}</td>
|
||||
<td>
|
||||
<v-text-field density="compact" hide-details="auto" v-model.number="itemsOwned" @update:model-value="updateOwned(props.itemID, itemsOwned)"></v-text-field>
|
||||
</td>
|
||||
<td class="text-right">{{ minTotalValue }}</td>
|
||||
<td class="text-right">{{ maxTotalValue }}</td>
|
||||
<td class="text-right">{{ aveTotalValue }}</td>
|
||||
</tr>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
</style>
|
||||
35
src/components/StandardItem.vue
Normal file
35
src/components/StandardItem.vue
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { computed } from 'vue';
|
||||
import { usePowerItems } from '@/stores/powerItems'
|
||||
|
||||
interface Props {
|
||||
itemID: string
|
||||
itemName: string
|
||||
itemIcon: string
|
||||
owned: number
|
||||
minPower: number
|
||||
maxPower: number
|
||||
}
|
||||
|
||||
const props = defineProps<Props>()
|
||||
const itemsOwned = ref(props.owned)
|
||||
const { updateOwned } = usePowerItems()
|
||||
|
||||
const totalValue = computed(() => itemsOwned.value * props.maxPower)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<tr>
|
||||
<!-- <td>ICON</td> -->
|
||||
<td class="text-left">{{ props.itemName }}</td>
|
||||
<td class="text-right">{{ props.maxPower }}</td>
|
||||
<td>
|
||||
<v-text-field density="compact" hide-details="auto" v-model.number="itemsOwned" @update:model-value="updateOwned(props.itemID, itemsOwned)"></v-text-field>
|
||||
</td>
|
||||
<td class="text-right">{{ totalValue }}</td>
|
||||
</tr>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
</style>
|
||||
30
src/main.ts
Normal file
30
src/main.ts
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import './assets/main.css'
|
||||
|
||||
import { createApp } from 'vue'
|
||||
import { createPinia } from 'pinia'
|
||||
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
|
||||
// Vuetify
|
||||
import 'vuetify/styles'
|
||||
import '@mdi/font/css/materialdesignicons.css'
|
||||
import { createVuetify } from 'vuetify'
|
||||
import * as components from 'vuetify/components'
|
||||
import * as directives from 'vuetify/directives'
|
||||
|
||||
const vuetify = createVuetify({
|
||||
components,
|
||||
directives,
|
||||
icons: {
|
||||
defaultSet: 'mdi',
|
||||
}
|
||||
})
|
||||
|
||||
const app = createApp(App)
|
||||
|
||||
app.use(createPinia())
|
||||
app.use(router)
|
||||
app.use(vuetify)
|
||||
|
||||
app.mount('#app')
|
||||
25
src/router/index.ts
Normal file
25
src/router/index.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
import HomeView from '../views/HomeView.vue'
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(import.meta.env.BASE_URL),
|
||||
routes: [
|
||||
{
|
||||
path: '/',
|
||||
name: 'home',
|
||||
component: HomeView
|
||||
},
|
||||
{
|
||||
path: "/blessing-power",
|
||||
name: "blessing-power",
|
||||
component: () => import('@/views/BlessingPowerView.vue')
|
||||
},
|
||||
{
|
||||
path: "/fellow-power",
|
||||
name: "fellow-power",
|
||||
component: () => import('@/views/FellowPowerView.vue')
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
export default router
|
||||
12
src/stores/counter.ts
Normal file
12
src/stores/counter.ts
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import { ref, computed } from 'vue'
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
export const useCounterStore = defineStore('counter', () => {
|
||||
const count = ref(0)
|
||||
const doubleCount = computed(() => count.value * 2)
|
||||
function increment() {
|
||||
count.value++
|
||||
}
|
||||
|
||||
return { count, doubleCount, increment }
|
||||
})
|
||||
241
src/stores/powerItems.ts
Normal file
241
src/stores/powerItems.ts
Normal file
|
|
@ -0,0 +1,241 @@
|
|||
import type { PowerItem } from '@/types/PowerItem'
|
||||
import axios from 'axios'
|
||||
import { defineStore } from 'pinia'
|
||||
import { computed, ref, toRaw } from 'vue'
|
||||
|
||||
export const usePowerItems = defineStore('powerItems', () => {
|
||||
const BLESSING_POWER_ITEM_STORAGE = 'BLESSING_POWER_ITEM_STORAGE'
|
||||
const FELLOW_POWER_ITEM_STORAGE = 'FELLOW_POWER_ITEM_STORAGE'
|
||||
const blessingPowerItems = ref(new Map<string, PowerItem>())
|
||||
const fellowPowerItems = ref(new Map<string, PowerItem>())
|
||||
|
||||
async function fetchPowerItems() {
|
||||
axios
|
||||
.get('/items/blessingPowerItems.json')
|
||||
.then((resp) => {
|
||||
const plainMap = new Map<string, PowerItem>(
|
||||
Object.entries(JSON.parse(localStorage.getItem(BLESSING_POWER_ITEM_STORAGE) || '{}'))
|
||||
)
|
||||
Object.keys(resp.data).map((key) => {
|
||||
const cur = resp.data[key]
|
||||
if (cur['owned'] === undefined) cur['owned'] = 0
|
||||
cur['owned'] = plainMap.get(key) !== undefined ? plainMap.get(key)?.owned : 0
|
||||
blessingPowerItems.value.set(key, resp.data[key])
|
||||
})
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
axios
|
||||
.get('/items/fellowPowerItems.json')
|
||||
.then((resp) => {
|
||||
const plainMap = new Map<string, PowerItem>(
|
||||
Object.entries(JSON.parse(localStorage.getItem(FELLOW_POWER_ITEM_STORAGE) || '{}'))
|
||||
)
|
||||
Object.keys(resp.data).map((key) => {
|
||||
const cur = resp.data[key]
|
||||
if (cur['owned'] === undefined) cur['owned'] = 0
|
||||
cur['owned'] = plainMap.get(key) !== undefined ? plainMap.get(key)?.owned : 0
|
||||
fellowPowerItems.value.set(key, resp.data[key])
|
||||
})
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
}
|
||||
|
||||
function updateOwned(key: string, newOwned: number) {
|
||||
let cur = blessingPowerItems.value.get(key)
|
||||
if (cur !== undefined) {
|
||||
cur.owned = newOwned
|
||||
blessingPowerItems.value.set(key, cur)
|
||||
localStorage.setItem(
|
||||
BLESSING_POWER_ITEM_STORAGE,
|
||||
JSON.stringify(mapToObj(toRaw(blessingPowerItems.value)))
|
||||
)
|
||||
return
|
||||
}
|
||||
cur = fellowPowerItems.value.get(key)
|
||||
if (cur !== undefined) {
|
||||
cur.owned = newOwned
|
||||
fellowPowerItems.value.set(key, cur)
|
||||
localStorage.setItem(
|
||||
FELLOW_POWER_ITEM_STORAGE,
|
||||
JSON.stringify(mapToObj(toRaw(fellowPowerItems.value)))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function mapToObj(map: Map<string, PowerItem>) {
|
||||
return Array.from(map).reduce((obj, [key, value]) => {
|
||||
// Doing weird magic to work with maps is infuriating, and I haven't found a better solution for this.
|
||||
// So ignore that error TypeScript, I (don't) know what I'm doing!
|
||||
// @ts-ignore: noImplicitAny
|
||||
obj[key] = value
|
||||
return obj
|
||||
}, {})
|
||||
}
|
||||
|
||||
const totalBlessingPower = computed(() =>
|
||||
[...blessingPowerItems.value.values()].reduce(
|
||||
(accumulator: number, currentValue: PowerItem) => {
|
||||
return currentValue !== undefined
|
||||
? accumulator +
|
||||
((currentValue.maxItemPower + currentValue.minItemPower) / 2) * currentValue.owned
|
||||
: 0
|
||||
},
|
||||
0
|
||||
)
|
||||
)
|
||||
|
||||
const standardBlessingItems = computed(
|
||||
() =>
|
||||
new Map(
|
||||
[...blessingPowerItems.value.entries()].filter(
|
||||
(cur) => cur[1].maxItemPower === cur[1].minItemPower
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
const standardBlessingItemTotal = computed(() =>
|
||||
[...standardBlessingItems.value.values()].reduce(
|
||||
(accumulator: number, currentValue: PowerItem) =>
|
||||
currentValue !== undefined
|
||||
? accumulator +
|
||||
((currentValue.maxItemPower + currentValue.minItemPower) / 2) * currentValue.owned
|
||||
: 0,
|
||||
0
|
||||
)
|
||||
)
|
||||
|
||||
const specialBlessingItems = computed(
|
||||
() =>
|
||||
new Map(
|
||||
[...blessingPowerItems.value.entries()].filter(
|
||||
(cur) => cur[1].maxItemPower !== cur[1].minItemPower
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
const specialBlessingItemsMinTotal = computed(() =>
|
||||
[...specialBlessingItems.value.values()].reduce(
|
||||
(accumulator: number, currentValue: PowerItem) =>
|
||||
currentValue !== undefined
|
||||
? accumulator + currentValue.minItemPower * currentValue.owned
|
||||
: 0,
|
||||
0
|
||||
)
|
||||
)
|
||||
|
||||
const specialBlessingItemsMaxTotal = computed(() =>
|
||||
[...specialBlessingItems.value.values()].reduce(
|
||||
(accumulator: number, currentValue: PowerItem) =>
|
||||
currentValue !== undefined
|
||||
? accumulator + currentValue.maxItemPower * currentValue.owned
|
||||
: 0,
|
||||
0
|
||||
)
|
||||
)
|
||||
|
||||
const specialBlessingItemsAveTotal = computed(() =>
|
||||
[...specialBlessingItems.value.values()].reduce(
|
||||
(accumulator: number, currentValue: PowerItem) =>
|
||||
currentValue !== undefined
|
||||
? accumulator +
|
||||
((currentValue.maxItemPower + currentValue.minItemPower) / 2) * currentValue.owned
|
||||
: 0,
|
||||
0
|
||||
)
|
||||
)
|
||||
|
||||
const totalFellowPower = computed(() =>
|
||||
[...fellowPowerItems.value.values()].reduce((accumulator: number, currentValue: PowerItem) => {
|
||||
return currentValue !== undefined
|
||||
? accumulator +
|
||||
((currentValue.maxItemPower + currentValue.minItemPower) / 2) * currentValue.owned
|
||||
: 0
|
||||
}, 0)
|
||||
)
|
||||
|
||||
const standardFellowItems = computed(
|
||||
() =>
|
||||
new Map(
|
||||
[...fellowPowerItems.value.entries()].filter(
|
||||
(cur) => cur[1].maxItemPower === cur[1].minItemPower
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
const standardFellowItemTotal = computed(() =>
|
||||
[...standardFellowItems.value.values()].reduce(
|
||||
(accumulator: number, currentValue: PowerItem) =>
|
||||
currentValue !== undefined
|
||||
? accumulator +
|
||||
((currentValue.maxItemPower + currentValue.minItemPower) / 2) * currentValue.owned
|
||||
: 0,
|
||||
0
|
||||
)
|
||||
)
|
||||
|
||||
const specialFellowItems = computed(
|
||||
() =>
|
||||
new Map(
|
||||
[...fellowPowerItems.value.entries()].filter(
|
||||
(cur) => cur[1].maxItemPower !== cur[1].minItemPower
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
const specialFellowItemsMinTotal = computed(() =>
|
||||
[...specialFellowItems.value.values()].reduce(
|
||||
(accumulator: number, currentValue: PowerItem) =>
|
||||
currentValue !== undefined
|
||||
? accumulator + currentValue.minItemPower * currentValue.owned
|
||||
: 0,
|
||||
0
|
||||
)
|
||||
)
|
||||
|
||||
const specialFellowItemsMaxTotal = computed(() =>
|
||||
[...specialFellowItems.value.values()].reduce(
|
||||
(accumulator: number, currentValue: PowerItem) =>
|
||||
currentValue !== undefined
|
||||
? accumulator + currentValue.maxItemPower * currentValue.owned
|
||||
: 0,
|
||||
0
|
||||
)
|
||||
)
|
||||
|
||||
const specialFellowItemsAveTotal = computed(() =>
|
||||
[...specialFellowItems.value.values()].reduce(
|
||||
(accumulator: number, currentValue: PowerItem) =>
|
||||
currentValue !== undefined
|
||||
? accumulator +
|
||||
((currentValue.maxItemPower + currentValue.minItemPower) / 2) * currentValue.owned
|
||||
: 0,
|
||||
0
|
||||
)
|
||||
)
|
||||
|
||||
fetchPowerItems()
|
||||
|
||||
return {
|
||||
blessingPowerItems,
|
||||
fetchPowerItems,
|
||||
updateOwned,
|
||||
totalBlessingPower,
|
||||
standardBlessingItems,
|
||||
standardBlessingItemTotal,
|
||||
specialBlessingItems,
|
||||
specialBlessingItemsMinTotal,
|
||||
specialBlessingItemsMaxTotal,
|
||||
specialBlessingItemsAveTotal,
|
||||
totalFellowPower,
|
||||
standardFellowItems,
|
||||
standardFellowItemTotal,
|
||||
specialFellowItems,
|
||||
specialFellowItemsMinTotal,
|
||||
specialFellowItemsMaxTotal,
|
||||
specialFellowItemsAveTotal
|
||||
}
|
||||
})
|
||||
1
src/styles/settings.scss
Normal file
1
src/styles/settings.scss
Normal file
|
|
@ -0,0 +1 @@
|
|||
@forward 'vuetify/settings';
|
||||
7
src/types/PowerItem.ts
Normal file
7
src/types/PowerItem.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
export type PowerItem = {
|
||||
iconURL: string
|
||||
itemName: string
|
||||
minItemPower: number
|
||||
maxItemPower: number
|
||||
owned: number
|
||||
}
|
||||
26
src/views/BlessingPowerView.vue
Normal file
26
src/views/BlessingPowerView.vue
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<script setup lang="ts">
|
||||
import SpecialItemsCard from '@/components/BlessingPower/SpecialItemsCard.vue'
|
||||
import StandardItemsCard from '@/components/BlessingPower/StandardItemsCard.vue'
|
||||
import SummaryCard from '@/components/BlessingPower/SummaryCard.vue'
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-container>
|
||||
<v-row justify="center">
|
||||
<v-col><StandardItemsCard /></v-col>
|
||||
<v-col><SpecialItemsCard /></v-col>
|
||||
</v-row>
|
||||
<v-row justify="center">
|
||||
<v-col cols="6">
|
||||
<SummaryCard />
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@use "@/styles/settings.scss";
|
||||
:deep(tbody) tr:nth-of-type(even) {
|
||||
background-color: map-get(settings.$purple, "lighten-5");
|
||||
}
|
||||
</style>
|
||||
26
src/views/FellowPowerView.vue
Normal file
26
src/views/FellowPowerView.vue
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<script setup lang="ts">
|
||||
import SpecialItemsCard from '@/components/FellowPower/SpecialItemsCard.vue'
|
||||
import StandardItemsCard from '@/components/FellowPower/StandardItemsCard.vue'
|
||||
import SummaryCard from '@/components/FellowPower/SummaryCard.vue'
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-container>
|
||||
<v-row justify="center">
|
||||
<v-col><StandardItemsCard /></v-col>
|
||||
<v-col><SpecialItemsCard /></v-col>
|
||||
</v-row>
|
||||
<v-row justify="center">
|
||||
<v-col cols="6">
|
||||
<SummaryCard />
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@use "@/styles/settings.scss";
|
||||
:deep(tbody) tr:nth-of-type(even) {
|
||||
background-color: map-get(settings.$purple, "lighten-5");
|
||||
}
|
||||
</style>
|
||||
11
src/views/HomeView.vue
Normal file
11
src/views/HomeView.vue
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<script setup lang="ts">
|
||||
import { RouterLink } from 'vue-router';
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<main>
|
||||
<RouterLink :to="{ name: 'blessing-power' }">
|
||||
<v-btn>Blessing Power</v-btn>
|
||||
</RouterLink>
|
||||
</main>
|
||||
</template>
|
||||
Loading…
Add table
Add a link
Reference in a new issue