feat: mission tab first draft
This commit is contained in:
parent
6c61c96091
commit
eedceccd3d
|
@ -0,0 +1,74 @@
|
|||
<template>
|
||||
<button
|
||||
class="relative flex flex-col pt-2 pb-3 px-3 border rounded-lg overflow-hidden"
|
||||
:class="[colorClasses, clickable ? 'cursor-pointer' : 'cursor-default']"
|
||||
:disable="!clickable"
|
||||
>
|
||||
<progress
|
||||
v-if="!clickable"
|
||||
class="absolute top-0 left-0 right-0 h-1 w-full"
|
||||
:max="max"
|
||||
:value="value"
|
||||
/>
|
||||
|
||||
<span class="absolute top-3 right-3 font-semibold text-sm">
|
||||
{{ value }} / {{ max }}
|
||||
<span class="fas fa-hourglass-half" />
|
||||
</span>
|
||||
|
||||
<span
|
||||
class="w-full text-left lg:text-center text-lg md:text-xl font-semibold"
|
||||
v-text="label"
|
||||
/>
|
||||
|
||||
<p class="w-full text-left" v-text="description" />
|
||||
</button>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
label: { type: String, required: true },
|
||||
description: { type: String, default: null },
|
||||
max: { type: Number, required: true },
|
||||
value: { type: Number, required: true },
|
||||
unit: { type: String, default: null },
|
||||
},
|
||||
computed: {
|
||||
clickable() {
|
||||
return this.value >= this.max
|
||||
},
|
||||
colorClasses() {
|
||||
const { lightColor, darkColor } = this.$store.getters.activeTab
|
||||
|
||||
return this.clickable
|
||||
? `bg-${darkColor} text-${lightColor}`
|
||||
: `bg-${lightColor} text-${darkColor}`
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
button {
|
||||
border-color: currentColor;
|
||||
}
|
||||
/* progress background for all browsers */
|
||||
progress::-webkit-progress-bar {
|
||||
background-color: rgba(0, 0, 0, 0.1);
|
||||
width: 100%;
|
||||
}
|
||||
progress {
|
||||
background-color: rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
/* progress value for all browsers */
|
||||
progress::-webkit-progress-value {
|
||||
background-color: currentColor;
|
||||
}
|
||||
progress::-moz-progress-bar {
|
||||
background-color: currentColor;
|
||||
}
|
||||
progress {
|
||||
color: currentColor;
|
||||
}
|
||||
</style>
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div class="tab-content grid flex-col">
|
||||
<div
|
||||
v-for="(process, index) in $store.state.incremental.processes"
|
||||
v-for="(process, index) in $store.state.processes"
|
||||
:key="index"
|
||||
class="flex flex-col mb-4 p-4 rounded border"
|
||||
:class="`border-${$store.getters.activeTab.darkColor}`"
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
<template>
|
||||
<div class="tab-content grid md:overflow-hidden">
|
||||
<template v-for="(mission, index) in $store.state.missions">
|
||||
<progress-button
|
||||
:key="index"
|
||||
:label="mission.name"
|
||||
:description="mission.description"
|
||||
:max="100"
|
||||
:value="50 * (2 - index)"
|
||||
/>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.tab-content {
|
||||
--columns: 1;
|
||||
grid-template-columns: repeat(var(--columns), minmax(0, 1fr));
|
||||
grid-gap: 1rem;
|
||||
}
|
||||
/* md */
|
||||
@media (min-width: 768px) {
|
||||
.tab-content {
|
||||
--columns: 2;
|
||||
}
|
||||
}
|
||||
/* 2xl */
|
||||
@media (min-width: 1536px) {
|
||||
.tab-content {
|
||||
--columns: 3;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -35,10 +35,7 @@
|
|||
>
|
||||
<first-tab-content v-if="$store.state.activeTabIndex === 0" />
|
||||
<second-tab-content v-else-if="$store.state.activeTabIndex === 1" />
|
||||
|
||||
<template v-else-if="$store.state.activeTabIndex === 2">
|
||||
Tab 3 content
|
||||
</template>
|
||||
<third-tab-content v-else-if="$store.state.activeTabIndex === 2" />
|
||||
|
||||
<template v-else-if="$store.state.activeTabIndex === 3">
|
||||
Tab 4 content
|
||||
|
@ -62,12 +59,8 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import FirstTabContent from '~/components/FirstTabContent.vue'
|
||||
import GameTab from '~/components/GameTab.vue'
|
||||
|
||||
export default {
|
||||
name: 'IndexPage',
|
||||
components: { GameTab, FirstTabContent },
|
||||
mounted() {
|
||||
window.setInterval(() => {
|
||||
this.gametick()
|
||||
|
|
|
@ -7,42 +7,42 @@ export const state = () => ({
|
|||
{
|
||||
id: 'instruments',
|
||||
label: '1',
|
||||
title: 'Tab 1 Title',
|
||||
title: 'Instruments',
|
||||
darkColor: 'yellow-600',
|
||||
lightColor: 'yellow-200',
|
||||
},
|
||||
{
|
||||
id: 'upgrades',
|
||||
label: '2',
|
||||
title: 'Tab 2 Title',
|
||||
title: 'Upgrades',
|
||||
darkColor: 'blue-600',
|
||||
lightColor: 'blue-200',
|
||||
},
|
||||
{
|
||||
id: 'fathertime',
|
||||
id: 'missions',
|
||||
label: '3',
|
||||
title: 'Tab 3 Title',
|
||||
title: 'Missions',
|
||||
darkColor: 'violet-600',
|
||||
lightColor: 'violet-200',
|
||||
},
|
||||
{
|
||||
id: 'timemachine',
|
||||
label: '4',
|
||||
title: 'Tab 4 Title',
|
||||
title: 'Time Machine',
|
||||
darkColor: 'lime-600',
|
||||
lightColor: 'lime-200',
|
||||
},
|
||||
{
|
||||
id: 'achievements',
|
||||
label: '5',
|
||||
title: 'Tab 5 Title',
|
||||
title: 'Time Magic',
|
||||
darkColor: 'orange-600',
|
||||
lightColor: 'orange-200',
|
||||
},
|
||||
{
|
||||
id: 'prestige',
|
||||
label: '6',
|
||||
title: 'Tab 6 Title',
|
||||
title: 'Etc.',
|
||||
darkColor: 'teal-600',
|
||||
lightColor: 'teal-200',
|
||||
},
|
||||
|
@ -83,6 +83,33 @@ export const state = () => ({
|
|||
purchased: false,
|
||||
},
|
||||
],
|
||||
|
||||
missions: [
|
||||
{
|
||||
name: 'Create the Time Machine',
|
||||
description: 'Soon you will be able to control time itself.',
|
||||
completionCriteria: {
|
||||
cost: 1000,
|
||||
},
|
||||
available: true,
|
||||
viewed: false,
|
||||
complete: false,
|
||||
},
|
||||
{
|
||||
name: 'Time To Cheat Death',
|
||||
description:
|
||||
'Your body seems to be failing you. ' +
|
||||
'Write a book to pass your knowedge to your younger self through the time machine. ' +
|
||||
"Now where's your pen...",
|
||||
appearanceCriteria: {
|
||||
age: 100,
|
||||
},
|
||||
completionCriteria: null,
|
||||
available: true,
|
||||
viewed: false,
|
||||
complete: false,
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
export const getters = {
|
||||
|
@ -117,4 +144,13 @@ export const mutations = {
|
|||
setProcessCompletion: (state, { processIndex, value }) => {
|
||||
Vue.set(state.processes[processIndex], 'completion', value)
|
||||
},
|
||||
setMissionAvailable: (state, missionIndex) => {
|
||||
Vue.set(state.missions[missionIndex], 'available', true)
|
||||
},
|
||||
setMissionViewed: (state, missionIndex) => {
|
||||
Vue.set(state.missions[missionIndex], 'viewed', true)
|
||||
},
|
||||
completeMission: (state, missionIndex) => {
|
||||
state.missions[missionIndex].complete = true
|
||||
},
|
||||
}
|
||||
|
|
Reference in New Issue