diff --git a/availabili.tf/src/App.vue b/availabili.tf/src/App.vue index 2085285..98cfc88 100644 --- a/availabili.tf/src/App.vue +++ b/availabili.tf/src/App.vue @@ -28,6 +28,8 @@ header { } nav { + display: flex; + gap: 8px; width: 100%; font-size: 12px; text-align: center; @@ -35,21 +37,19 @@ nav { } nav a.router-link-exact-active { - color: var(--flamingo); -} - -nav a.router-link-exact-active:hover { - background-color: transparent; + color: var(--crust); + background-color: var(--accent); } nav a { padding: 0.5rem 1rem; color: var(--subtext-0); + border-radius: 8px; } nav a:hover { - color: var(--crust); - background-color: var(--flamingo); + color: var(--accent); + background-color: var(--accent-transparent); } @media (min-width: 1024px) { diff --git a/availabili.tf/src/assets/base.css b/availabili.tf/src/assets/base.css index 30049b9..0864268 100644 --- a/availabili.tf/src/assets/base.css +++ b/availabili.tf/src/assets/base.css @@ -20,19 +20,25 @@ --vt-c-text-dark-1: var(--vt-c-white); --vt-c-text-dark-2: rgba(235, 235, 235, 0.64); - --text: #c6d0f5; - --subtext-1: #b8c0e0; - --subtext-0: #a5adcb; - --overlay-2: #939ab7; - --overlay-1: #8087a2; - --overlay-0: #6e738d; + --text: #4c4f69; + --subtext-1: #5c5f77; + --subtext-0: #6c6f85; + --overlay-2: #7c7f93; + --overlay-1: #8c8fa1; + --overlay-0: #9ca0b0; + + --surface-0: #ccd0da; + --base: #eff1f5; + --mantle: #e6e9ef; + --crust: #dce0e8; - --surface-0: #363a4f; - --base: #24273a; - --mantle: #1e2030; - --crust: #181926; --flamingo: #f0c6c6; --flamingo-transparent: #f0c6c655; + --green: #a6e3a1; + --lavender: #7287fd; + --accent: var(--lavender); + --accent-transparent: color-mix(in srgb, var(--accent), transparent 80%); + } /* semantic color variables for this project */ diff --git a/availabili.tf/src/assets/main.css b/availabili.tf/src/assets/main.css index 4ecdc55..5924315 100644 --- a/availabili.tf/src/assets/main.css +++ b/availabili.tf/src/assets/main.css @@ -11,20 +11,24 @@ a, .green { text-decoration: none; - color: var(--flamingo); + color: var(--accent); transition: 0.4s; padding: 3px; } @media (hover: hover) { a:hover { - background-color: var(--flamingo-transparent); + background-color: var(--accent-transparent); } } -@media (min-width: 1024px) { - body { - display: flex; - place-items: center; - } +button { + color: var(--text); + border: none; +} + + +h1 { + font-weight: 800; + font-size: 300%; } diff --git a/availabili.tf/src/components/PlayerCard.vue b/availabili.tf/src/components/PlayerCard.vue index 6272138..978264a 100644 --- a/availabili.tf/src/components/PlayerCard.vue +++ b/availabili.tf/src/components/PlayerCard.vue @@ -1,6 +1,6 @@ diff --git a/availabili.tf/src/player.ts b/availabili.tf/src/player.ts index 181b181..2a0ba6d 100644 --- a/availabili.tf/src/player.ts +++ b/availabili.tf/src/player.ts @@ -8,4 +8,5 @@ export interface PlayerTeamRole { name: string; role: string; main: boolean; + availability: number; } diff --git a/availabili.tf/src/stores/roster.ts b/availabili.tf/src/stores/roster.ts index 042093e..c3b0adb 100644 --- a/availabili.tf/src/stores/roster.ts +++ b/availabili.tf/src/stores/roster.ts @@ -1,13 +1,158 @@ -import { type Player } from "@/player"; +import { type Player, type PlayerTeamRole } from "@/player"; import { defineStore } from "pinia"; -import { reactive, ref, type Reactive, type Ref } from "vue"; +import { computed, reactive, ref, type Reactive, type Ref } from "vue"; export const useRosterStore = defineStore("roster", () => { + const neededRoles: Reactive> = reactive([ + "Pocket Scout", + "Flank Scout", + "Pocket Soldier", + "Roamer", + "Demoman", + "Medic", + ]); + + const selectedPlayers: Reactive<{ [key: string]: PlayerTeamRole }> = reactive({}); + const selectedRole: Ref = ref("Pocket Scout"); - const availablePlayers: Reactive> = reactive([]); + + const availablePlayers: Reactive> = reactive([ + { + steamId: 2840, + name: "Wesker U", + role: "Flank Scout", + main: true, + availability: 1, + }, + { + steamId: 2839, + name: "JustGetAHouse", + role: "Flank Scout", + main: false, + availability: 1, + }, + { + steamId: 2839, + name: "JustGetAHouse", + role: "Pocket Scout", + main: true, + availability: 1, + }, + { + steamId: 2841, + name: "VADIKUS007", + role: "Pocket Soldier", + main: true, + availability: 2, + }, + { + steamId: 2841, + name: "VADIKUS007", + role: "Roamer", + main: false, + availability: 2, + }, + { + steamId: 2282, + name: "Bergman777", + role: "Demoman", + main: true, + availability: 2, + }, + { + steamId: 2842, + name: "BossOfThisGym", + role: "Roamer", + main: false, + availability: 2, + }, + { + steamId: 2842, + name: "BossOfThisGym", + role: "Demoman", + main: false, + availability: 2, + }, + { + steamId: 2842, + name: "BossOfThisGym", + role: "Pocket Scout", + main: false, + availability: 2, + }, + //{ + // steamId: 2843, + // name: "samme1g", + // role: "Medic", + // main: true, + // availability: 2, + //}, + { + steamId: 2843, + name: "samme1g", + role: "Pocket Soldier", + main: false, + availability: 2, + }, + { + steamId: 2843, + name: "samme1g", + role: "Roamer", + main: false, + availability: 2, + }, + { + steamId: 2844, + name: "FarbrorBarbro", + role: "Roamer", + main: true, + availability: 1, + }, + { + steamId: 2844, + name: "FarbrorBarbro", + role: "Pocket Soldier", + main: false, + availability: 1, + }, + ]); + + const availablePlayerRoles = computed(() => { + return availablePlayers.filter((player) => player.role == selectedRole.value); + }); + + const definitelyAvailable = computed(() => { + return availablePlayerRoles.value.filter((player) => player.availability == 2); + }); + + const canBeAvailable = computed(() => { + return availablePlayerRoles.value.filter((player) => player.availability == 1); + }); + + function selectPlayerForRole(player: PlayerTeamRole, role: string) { + console.log("selecting."); + if (player) { + const existingRole = Object.keys(selectedPlayers).find((selectedRole) => { + return selectedPlayers[selectedRole]?.steamId == player.steamId && + role != selectedRole; + }); + + if (existingRole) { + delete selectedPlayers[existingRole]; + } + } + + selectedPlayers[role] = player; + } return { + neededRoles, + selectedPlayers, selectedRole, availablePlayers, + availablePlayerRoles, + selectPlayerForRole, + definitelyAvailable, + canBeAvailable, } }); diff --git a/availabili.tf/src/views/RosterBuilderView.vue b/availabili.tf/src/views/RosterBuilderView.vue index 276cefb..34b5239 100644 --- a/availabili.tf/src/views/RosterBuilderView.vue +++ b/availabili.tf/src/views/RosterBuilderView.vue @@ -2,42 +2,43 @@ import PlayerCard from "../components/PlayerCard.vue"; import RoleSlot from "../components/RoleSlot.vue"; import PlayerTeamRole from "../player.ts"; -import { reactive } from "vue"; +import { computed, reactive } from "vue"; import { useRosterStore } from "../stores/roster"; const rosterStore = useRosterStore(); -const testPlayer: PlayerTeamRole = { - name: "JustGetAHouse", - role: "Pocket Scout", - main: false, -} - -const testPlayer2: PlayerTeamRole = { - name: "Wesker U", - role: "Pocket Scout", - main: true, -} - -const players = [testPlayer, testPlayer2]; - -const selectPlayers = reactive(); +const hasAvailablePlayers = computed(() => { + return rosterStore.availablePlayerRoles.length > 0; +});