Skip to content

Commit

Permalink
feat(game-lobby): all game lobby is responsive
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinezanardi committed Sep 16, 2024
1 parent 28e0e43 commit d20d9a5
Show file tree
Hide file tree
Showing 45 changed files with 145 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
>
<h4
:key="recipientRoleAdditionalCardsDisclaimerAndIcon.disclaimer"
class="mb-8 text-center"
class="mb-4 md:mb-8 text-center"
>
<FontAwesomeIcon
id="recipient-role-additional-cards-disclaimer-icon"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<PrimeVueFieldset
:id="`role-additional-cards-manager-${recipientRoleName}`"
:pt="{ 'legend': 'ml-4 !p-3 !px-6' }"
:pt="{ 'legend': FIELD_SETS_LEGEND_CLASSES }"
>
<template #legend>
<GameOptionRoleLegend :role-name="recipientRoleName"/>
Expand All @@ -19,7 +19,7 @@

<div
id="recipient-role-additional-cards-placement"
class="flex font-semibold h-6 items-center justify-center mt-3"
class="flex font-semibold items-center justify-center mt-3"
>
<span v-if="additionalCardsPlacementText">
<FontAwesomeIcon
Expand All @@ -41,6 +41,7 @@ import type { RecipientRoleAdditionalCardsManagerProps } from "~/components/page
import RecipientRoleAdditionalCardsDisclaimer from "~/components/pages/game-lobby/GameLobbyAdditionalCardsManager/GameLobbyAdditionalCardsManagerContent/RecipientRoleAdditionalCardsManager/RecipientRoleAdditionalCardsDisclaimer/RecipientRoleAdditionalCardsDisclaimer.vue";
import RecipientRoleAdditionalCardsMultiSelect from "~/components/pages/game-lobby/GameLobbyAdditionalCardsManager/GameLobbyAdditionalCardsManagerContent/RecipientRoleAdditionalCardsManager/RecipientRoleAdditionalCardsMultiSelect/RecipientRoleAdditionalCardsMultiSelect.vue";
import GameOptionRoleLegend from "~/components/shared/game/game-options/GameOptionRoleLegend/GameOptionRoleLegend.vue";
import { FIELD_SETS_LEGEND_CLASSES } from "~/components/shared/inputs/field-sets/field-sets.constants";
import { useCreateGameDtoStore } from "~/stores/game/create-game-dto/useCreateGameDtoStore";
const props = defineProps<RecipientRoleAdditionalCardsManagerProps>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
:options="availableAdditionalCards"
:placeholder="$t('components.RecipientRoleAdditionalCardsMultiSelect.pickOneToFiveCards')"
:pt="{
'labelContainer': 'flex justify-center items-center h-20',
'chipItem': 'flex items-center bg-gray-800 rounded gap-2 px-2 py-1'
'labelContainer': 'flex justify-center items-center md:h-20',
'chipItem': 'flex items-center bg-gray-800 rounded md:gap-2 md:px-2 md:py-1',
'chipIcon': '!p-1 !w-2'
}"
reset-filter-on-hide
:selection-limit="5"
Expand All @@ -40,14 +41,17 @@

<template #chip="{ value }">
<RoleImage
definition="small"
:role-name="value.roleName"
size="small"
:sizes="roleImageSizes"
/>

<span>{{ value.label }}</span>
<span class="hidden lg:inline">
{{ value.label }}
</span>

<PrimeVueButton
class="p-button-rounded p-button-sm p-button-text remove-additional-card-button"
class="!hidden md:!inline p-button-rounded p-button-sm p-button-text remove-additional-card-button"
:data-testid="`recipient-role-additional-cards-multi-select-remove-${value.roleName}-for-${recipientRoleName}`"
@click.stop="onClickFromRemoveAdditionalCardButton(value)"
>
Expand All @@ -62,6 +66,7 @@

<script setup lang="ts">
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
import { breakpointsTailwind, useBreakpoints } from "@vueuse/core";
import { storeToRefs } from "pinia";
import type { LabeledCreateGameAdditionalCardDto, RecipientRoleAdditionalCardsMultiSelectProps } from "~/components/pages/game-lobby/GameLobbyAdditionalCardsManager/GameLobbyAdditionalCardsManagerContent/RecipientRoleAdditionalCardsManager/RecipientRoleAdditionalCardsMultiSelect/recipient-role-additional-cards-multi-select.types";
import RoleImage from "~/components/shared/role/RoleImage/RoleImage.vue";
Expand All @@ -70,9 +75,13 @@ import type { RoleName } from "~/composables/api/role/types/role.types";
import { useRoleName } from "~/composables/api/role/useRoleName";
import { useCreateGameDtoStore } from "~/stores/game/create-game-dto/useCreateGameDtoStore";
import { useRolesStore } from "~/stores/role/useRolesStore";
import { BreakpointTypes } from "~/utils/enums/breakpoint.enums";
const props = defineProps<RecipientRoleAdditionalCardsMultiSelectProps>();
const breakpoints = useBreakpoints(breakpointsTailwind);
const isSmallerThanMd = breakpoints.smaller(BreakpointTypes.MD);
const createGameDtoStore = useCreateGameDtoStore();
const { getAdditionalCardsForRecipientInCreateGameDto } = createGameDtoStore;
const { createGameDto } = storeToRefs(createGameDtoStore);
Expand All @@ -81,6 +90,8 @@ const rolesStore = useRolesStore();
const { getRolesForRecipientRoleName } = rolesStore;
const { getRoleNameLabel } = useRoleName();
const roleImageSizes = computed<string>(() => (isSmallerThanMd.value ? "35px" : "50px"));
const selectedAdditionalCards = computed<CreateGameAdditionalCardDto[]>({
get: () => getAdditionalCardsForRecipientInCreateGameDto(props.recipientRoleName),
set: (value: CreateGameAdditionalCardDto[]) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
icon="clover"
/>

<span id="game-lobby-header-additional-cards-manager-button-text">
<span
id="game-lobby-header-additional-cards-manager-button-text"
class="hidden md:inline"
>
{{ $t('components.GameLobbyHeaderAdditionalCardsManagerButton.additionalCards') }}
</span>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
icon="magic-wand-sparkles"
/>

<span id="button-text">
<span
id="button-text"
class="hidden md:inline"
>
{{ $t("components.GameLobbyHeaderOptionsButton.gameOptions") }}
</span>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
<template>
<PrimeVueButton
id="game-lobby-header-position-coordinator-button"
:label="$t('components.GameLobbyHeaderPositionCoordinatorButton.positionCoordinator')"
:pt="{ 'root': '!border-sky-600' }"
severity="info"
size="small"
@click.prevent="onClickFromGamePositionCoordinatorButton"
>
<template #icon>
<FontAwesomeIcon
class="animate__animated animate__heartBeat animate__slow"
icon="users"
/>
</template>
<FontAwesomeIcon
class="animate__animated animate__heartBeat animate__slow"
icon="users"
/>

<span
class="hidden md:inline"
>
{{ $t("components.GameLobbyHeaderPositionCoordinatorButton.positionCoordinator") }}
</span>
</PrimeVueButton>
</template>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<template>
<PrimeVueButtonGroup>
<PrimeVueButtonGroup class="text-center w-full">
<TransitionGroup
name="fade-list"
tag="div"
>
<GameLobbyHeaderOptionsButton
id="game-lobby-header-options-button"
key="game-options-button"
ref="gameLobbyHeaderOptionsButton"
class="fade-list-item"
class="fade-list-item h-10 md:h-auto md:w-auto w-1/4"
@game-options-button-click="onGameOptionsButtonClickFromGameOptionButton"
/>

Expand All @@ -16,7 +17,7 @@
id="game-lobby-header-position-coordinator-button"
key="game-position-coordinator-button"
ref="gameLobbyHeaderPositionCoordinatorButton"
class="fade-list-item"
class="fade-list-item h-10 md:h-auto md:w-auto w-1/4"
@position-coordinator-button-click="onPositionCoordinatorButtonClickFromGamePositionCoordinatorButton"
/>

Expand All @@ -25,7 +26,7 @@
id="game-lobby-header-additional-cards-manager-button"
key="game-additional-cards-manager-button"
ref="gameLobbyHeaderAdditionalCardsManagerButton"
class="fade-list-item"
class="fade-list-item h-10 md:h-auto md:w-auto w-1/4"
@additional-cards-manager-button-click="onAdditionalCardsManagerButtonClickFromGameAdditionalCardsManagerButton"
/>
</TransitionGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'root': 'h-9/10',
'icons': 'pb-2',
'header': '!py-2',
'content': 'w-x-screen-9/10 max-w-x-screen-9/10 h-full !py-0',
'content': 'w-x-screen-9/10 max-w-x-screen-9/10 h-full !py-0 !px-0 md:!px-2',
'footer': '!py-2'
}"
:visible="isVisible"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
>
<PrimeVueDivider class="!my-2"/>

<div class="flex justify-between w-full">
<div class="flex gap-1 justify-between w-full">
<Transition
mode="out-in"
name="fade"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<PrimeVueFieldset
id="game-lobby-options-hub-roles-tab-actor"
:pt="{ 'legend': 'ml-4 !p-3 !px-6' }"
:pt="{ 'legend': FIELD_SETS_LEGEND_CLASSES }"
>
<template #legend>
<GameOptionRoleLegend role-name="actor"/>
Expand All @@ -28,6 +28,7 @@ import { storeToRefs } from "pinia";
import AffirmativeToggleButton from "~/components/shared/buttons/AffirmativeToggleButton/AffirmativeToggleButton.vue";
import GameOptionInputGroup from "~/components/shared/game/game-options/GameOptionInputGroup/GameOptionInputGroup.vue";
import GameOptionRoleLegend from "~/components/shared/game/game-options/GameOptionRoleLegend/GameOptionRoleLegend.vue";
import { FIELD_SETS_LEGEND_CLASSES } from "~/components/shared/inputs/field-sets/field-sets.constants";
import { CreateGameDto } from "~/composables/api/game/dto/create-game/create-game.dto";
import { useGameOptionsTexts } from "~/composables/api/game/game-options/useGameOptionsTexts";
import { useCreateGameDtoStore } from "~/stores/game/create-game-dto/useCreateGameDtoStore";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<PrimeVueFieldset
id="game-lobby-options-hub-roles-tab-bear-tamer"
:pt="{ 'legend': 'ml-4 !p-3 !px-6' }"
:pt="{ 'legend': FIELD_SETS_LEGEND_CLASSES }"
>
<template #legend>
<GameOptionRoleLegend role-name="bear-tamer"/>
Expand All @@ -28,6 +28,7 @@ import { storeToRefs } from "pinia";
import AffirmativeToggleButton from "~/components/shared/buttons/AffirmativeToggleButton/AffirmativeToggleButton.vue";
import GameOptionInputGroup from "~/components/shared/game/game-options/GameOptionInputGroup/GameOptionInputGroup.vue";
import GameOptionRoleLegend from "~/components/shared/game/game-options/GameOptionRoleLegend/GameOptionRoleLegend.vue";
import { FIELD_SETS_LEGEND_CLASSES } from "~/components/shared/inputs/field-sets/field-sets.constants";
import { CreateGameDto } from "~/composables/api/game/dto/create-game/create-game.dto";
import { useGameOptionsTexts } from "~/composables/api/game/game-options/useGameOptionsTexts";
import { useCreateGameDtoStore } from "~/stores/game/create-game-dto/useCreateGameDtoStore";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<PrimeVueFieldset
id="game-lobby-options-hub-roles-tab-big-bad-wolf"
:pt="{ 'legend': 'ml-4 !p-3 !px-6' }"
:pt="{ 'legend': FIELD_SETS_LEGEND_CLASSES }"
>
<template #legend>
<GameOptionRoleLegend role-name="big-bad-wolf"/>
Expand All @@ -28,6 +28,7 @@ import { storeToRefs } from "pinia";
import AffirmativeToggleButton from "~/components/shared/buttons/AffirmativeToggleButton/AffirmativeToggleButton.vue";
import GameOptionInputGroup from "~/components/shared/game/game-options/GameOptionInputGroup/GameOptionInputGroup.vue";
import GameOptionRoleLegend from "~/components/shared/game/game-options/GameOptionRoleLegend/GameOptionRoleLegend.vue";
import { FIELD_SETS_LEGEND_CLASSES } from "~/components/shared/inputs/field-sets/field-sets.constants";
import { CreateGameDto } from "~/composables/api/game/dto/create-game/create-game.dto";
import { useGameOptionsTexts } from "~/composables/api/game/game-options/useGameOptionsTexts";
import { useCreateGameDtoStore } from "~/stores/game/create-game-dto/useCreateGameDtoStore";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<PrimeVueFieldset
id="game-lobby-options-hub-roles-tab-cupid"
:pt="{ 'legend': 'ml-4 !p-3 !px-6' }"
:pt="{ 'legend': FIELD_SETS_LEGEND_CLASSES }"
>
<template #legend>
<GameOptionRoleLegend role-name="cupid"/>
Expand Down Expand Up @@ -43,6 +43,7 @@ import { storeToRefs } from "pinia";
import AffirmativeToggleButton from "~/components/shared/buttons/AffirmativeToggleButton/AffirmativeToggleButton.vue";
import GameOptionInputGroup from "~/components/shared/game/game-options/GameOptionInputGroup/GameOptionInputGroup.vue";
import GameOptionRoleLegend from "~/components/shared/game/game-options/GameOptionRoleLegend/GameOptionRoleLegend.vue";
import { FIELD_SETS_LEGEND_CLASSES } from "~/components/shared/inputs/field-sets/field-sets.constants";
import { CreateGameDto } from "~/composables/api/game/dto/create-game/create-game.dto";
import { useGameOptionsTexts } from "~/composables/api/game/game-options/useGameOptionsTexts";
import { useCreateGameDtoStore } from "~/stores/game/create-game-dto/useCreateGameDtoStore";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<PrimeVueFieldset
id="game-lobby-options-hub-roles-tab-defender"
:pt="{ 'legend': 'ml-4 !p-3 !px-6' }"
:pt="{ 'legend': FIELD_SETS_LEGEND_CLASSES }"
>
<template #legend>
<GameOptionRoleLegend role-name="defender"/>
Expand All @@ -28,6 +28,7 @@ import { storeToRefs } from "pinia";
import AffirmativeToggleButton from "~/components/shared/buttons/AffirmativeToggleButton/AffirmativeToggleButton.vue";
import GameOptionInputGroup from "~/components/shared/game/game-options/GameOptionInputGroup/GameOptionInputGroup.vue";
import GameOptionRoleLegend from "~/components/shared/game/game-options/GameOptionRoleLegend/GameOptionRoleLegend.vue";
import { FIELD_SETS_LEGEND_CLASSES } from "~/components/shared/inputs/field-sets/field-sets.constants";
import { CreateGameDto } from "~/composables/api/game/dto/create-game/create-game.dto";
import { useGameOptionsTexts } from "~/composables/api/game/game-options/useGameOptionsTexts";
import { useCreateGameDtoStore } from "~/stores/game/create-game-dto/useCreateGameDtoStore";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<PrimeVueFieldset
id="game-lobby-options-hub-roles-tab-elder"
:pt="{ 'legend': 'ml-4 !p-3 !px-6' }"
:pt="{ 'legend': FIELD_SETS_LEGEND_CLASSES }"
>
<template #legend>
<GameOptionRoleLegend role-name="elder"/>
Expand All @@ -15,7 +15,7 @@
option-icon-class="text-red-500"
:option-label="$t('components.GameLobbyOptionsHubRolesTabElder.options.livesCountAgainstWerewolves.label')"
>
<PrimeVueFloatLabel>
<PrimeVueFloatLabel class="!mt-4 md:!mt-0">
<label
id="game-lobby-options-hub-roles-tab-elder-lives-count-against-werewolves-label"
for="game-lobby-options-hub-roles-tab-elder-lives-count-against-werewolves-input"
Expand Down Expand Up @@ -63,6 +63,7 @@ import { storeToRefs } from "pinia";
import AffirmativeToggleButton from "~/components/shared/buttons/AffirmativeToggleButton/AffirmativeToggleButton.vue";
import GameOptionInputGroup from "~/components/shared/game/game-options/GameOptionInputGroup/GameOptionInputGroup.vue";
import GameOptionRoleLegend from "~/components/shared/game/game-options/GameOptionRoleLegend/GameOptionRoleLegend.vue";
import { FIELD_SETS_LEGEND_CLASSES } from "~/components/shared/inputs/field-sets/field-sets.constants";
import { CreateGameDto } from "~/composables/api/game/dto/create-game/create-game.dto";
import { useGameOptionsTexts } from "~/composables/api/game/game-options/useGameOptionsTexts";
import { useCreateGameDtoStore } from "~/stores/game/create-game-dto/useCreateGameDtoStore";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<PrimeVueFieldset
id="game-lobby-options-hub-roles-tab-fox"
:pt="{ 'legend': 'ml-4 !p-3 !px-6' }"
:pt="{ 'legend': FIELD_SETS_LEGEND_CLASSES }"
>
<template #legend>
<GameOptionRoleLegend role-name="fox"/>
Expand All @@ -28,6 +28,7 @@ import { storeToRefs } from "pinia";
import AffirmativeToggleButton from "~/components/shared/buttons/AffirmativeToggleButton/AffirmativeToggleButton.vue";
import GameOptionInputGroup from "~/components/shared/game/game-options/GameOptionInputGroup/GameOptionInputGroup.vue";
import GameOptionRoleLegend from "~/components/shared/game/game-options/GameOptionRoleLegend/GameOptionRoleLegend.vue";
import { FIELD_SETS_LEGEND_CLASSES } from "~/components/shared/inputs/field-sets/field-sets.constants";
import { CreateGameDto } from "~/composables/api/game/dto/create-game/create-game.dto";
import { useGameOptionsTexts } from "~/composables/api/game/game-options/useGameOptionsTexts";
import { useCreateGameDtoStore } from "~/stores/game/create-game-dto/useCreateGameDtoStore";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<PrimeVueFieldset
id="game-lobby-options-hub-roles-tab-general"
:pt="{ 'legend': 'ml-4 !p-3 !px-6' }"
:pt="{ 'legend': FIELD_SETS_LEGEND_CLASSES }"
>
<template #legend>
<div class="flex gap-4 items-center">
Expand Down Expand Up @@ -48,6 +48,7 @@
import { storeToRefs } from "pinia";
import AffirmativeToggleButton from "~/components/shared/buttons/AffirmativeToggleButton/AffirmativeToggleButton.vue";
import GameOptionInputGroup from "~/components/shared/game/game-options/GameOptionInputGroup/GameOptionInputGroup.vue";
import { FIELD_SETS_LEGEND_CLASSES } from "~/components/shared/inputs/field-sets/field-sets.constants";
import RoleImage from "~/components/shared/role/RoleImage/RoleImage.vue";
import { CreateGameDto } from "~/composables/api/game/dto/create-game/create-game.dto";
import { useGameOptionsTexts } from "~/composables/api/game/game-options/useGameOptionsTexts";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<PrimeVueFieldset
id="game-lobby-options-hub-roles-tab-idiot"
:pt="{ 'legend': 'ml-4 !p-3 !px-6' }"
:pt="{ 'legend': FIELD_SETS_LEGEND_CLASSES }"
>
<template #legend>
<GameOptionRoleLegend role-name="idiot"/>
Expand All @@ -28,6 +28,7 @@ import { storeToRefs } from "pinia";
import AffirmativeToggleButton from "~/components/shared/buttons/AffirmativeToggleButton/AffirmativeToggleButton.vue";
import GameOptionInputGroup from "~/components/shared/game/game-options/GameOptionInputGroup/GameOptionInputGroup.vue";
import GameOptionRoleLegend from "~/components/shared/game/game-options/GameOptionRoleLegend/GameOptionRoleLegend.vue";
import { FIELD_SETS_LEGEND_CLASSES } from "~/components/shared/inputs/field-sets/field-sets.constants";
import { CreateGameDto } from "~/composables/api/game/dto/create-game/create-game.dto";
import { useGameOptionsTexts } from "~/composables/api/game/game-options/useGameOptionsTexts";
import { useCreateGameDtoStore } from "~/stores/game/create-game-dto/useCreateGameDtoStore";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<PrimeVueFieldset
id="game-lobby-options-hub-roles-tab-little-girl"
:pt="{ 'legend': 'ml-4 !p-3 !px-6' }"
:pt="{ 'legend': FIELD_SETS_LEGEND_CLASSES }"
>
<template #legend>
<GameOptionRoleLegend role-name="little-girl"/>
Expand All @@ -28,6 +28,7 @@ import { storeToRefs } from "pinia";
import AffirmativeToggleButton from "~/components/shared/buttons/AffirmativeToggleButton/AffirmativeToggleButton.vue";
import GameOptionInputGroup from "~/components/shared/game/game-options/GameOptionInputGroup/GameOptionInputGroup.vue";
import GameOptionRoleLegend from "~/components/shared/game/game-options/GameOptionRoleLegend/GameOptionRoleLegend.vue";
import { FIELD_SETS_LEGEND_CLASSES } from "~/components/shared/inputs/field-sets/field-sets.constants";
import { CreateGameDto } from "~/composables/api/game/dto/create-game/create-game.dto";
import { useGameOptionsTexts } from "~/composables/api/game/game-options/useGameOptionsTexts";
import { useCreateGameDtoStore } from "~/stores/game/create-game-dto/useCreateGameDtoStore";
Expand Down
Loading

0 comments on commit d20d9a5

Please sign in to comment.