Skip to content

Commit

Permalink
Kitchen tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
NoelDeMartin committed Jan 5, 2025
1 parent 92995cb commit 56868e2
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 27 deletions.
12 changes: 6 additions & 6 deletions cypress/integration/kitchen.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('Kitchen', () => {
cy.press('Pa amb tomàquet');

// Act & Assert - Ingredients
cy.press('Let\'s cook!');
cy.press('Let\'s cook this!');
cy.see('Mise en place');
cy.see('Bread');
cy.see('1 Tomato');
Expand Down Expand Up @@ -51,7 +51,7 @@ describe('Kitchen', () => {
it('Uses timers', () => {
// Arrange
cy.press('Pa amb tomàquet');
cy.press('Let\'s cook!');
cy.press('Let\'s cook this!');
cy.press('Next');
cy.press('Show timers');

Expand All @@ -77,7 +77,7 @@ describe('Kitchen', () => {
it('Persists state', () => {
// Arrange
cy.press('Pa amb tomàquet');
cy.press('Let\'s cook!');
cy.press('Let\'s cook this!');
cy.press('Bread');
cy.press('Next');
cy.press('Show timers');
Expand All @@ -97,7 +97,7 @@ describe('Kitchen', () => {
cy.see('Timer 1');

cy.ariaLabel('Close the modal').click();
cy.press('Show ingredients');
cy.press('Previous');

cy.contains('label', 'Bread').within(() => {
cy.get('input').should('match', ':checked');
Expand All @@ -112,12 +112,12 @@ describe('Kitchen', () => {
cy.press('not now');

// Assert
cy.dontSee('Let\'s cook!');
cy.dontSee('Let\'s cook this!');

cy.go('back');
cy.press('Pa amb tomàquet');
cy.wait(1000);
cy.dontSee('Let\'s cook!');
cy.dontSee('Let\'s cook this!');
});

});
4 changes: 0 additions & 4 deletions src/components/AppHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@ const navigationButton = $computed(() => {
return 'logo';
});
const backText = $computed(() => {
if (Date.now()) {
return 'Noel De Martin\'s Public Recipes';
}
if (Viewer.active) {
return collection?.name
?? Viewer.collection?.name
Expand Down
22 changes: 11 additions & 11 deletions src/routing/pages/kitchen/components/KitchenPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<div class="w-full h-full overflow-auto">
<div class="mx-auto max-w-4xl pt-4 pb-8 px-edge md:pt-10 min-h-full flex flex-col">
<template v-if="recipe">
<h1 class="text-gray-500 opacity-50 font-medium tracking-wide uppercase text-xs">
<h1 class="text-gray-500 opacity-50 font-medium tracking-wide uppercase text-xs mr-8">
{{ $t('kitchen.title', { recipe: recipe.name }) }}
</h1>
<h2 class="text-2xl font-semibold mt-4">
Expand All @@ -29,16 +29,7 @@
</div>
</div>

<div class="fixed bottom-24 right-8 md:top-32 md:bottom-auto md:right-12 flex flex-col space-y-4 z-10">
<CoreButton
v-if="showKitchenShortcut && $kitchen.dishes.length > 1"
:title="$t('kitchen.index.show')"
route="kitchen"
secondary
>
<i-tabler-chef-hat-filled class="w-7 h-7" aria-hidden="true" />
<span class="sr-only">{{ $t('kitchen.index.show') }}</span>
</CoreButton>
<div class="fixed bottom-24 right-8 flex flex-col-reverse space-y-4 space-y-reverse z-10 md:top-32 md:bottom-auto md:right-12 md:flex-col md:space-y-4">
<CoreButton
:title="$t('kitchen.timers.show')"
secondary
Expand All @@ -53,6 +44,15 @@
</span>
</div>
</CoreButton>
<CoreButton
v-if="showKitchenShortcut && $kitchen.dishes.length > 1"
:title="$t('kitchen.index.show')"
route="kitchen"
secondary
>
<i-tabler-chef-hat-filled class="w-7 h-7" aria-hidden="true" />
<span class="sr-only">{{ $t('kitchen.index.show') }}</span>
</CoreButton>
</div>
</div>
</template>
Expand Down
14 changes: 10 additions & 4 deletions src/routing/pages/kitchen/components/KitchenTimer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@
{{ time }}
</span>
</div>
<div class="flex space-x-2 self-center mt-1">
<div
class="flex self-center mt-1"
:class="{
'flex-col space-y-2 md:flex-row md:space-y-0 md:space-x-2': timer.isPaused(),
'space-x-2': !timer.isPaused(),
}"
>
<CoreButton
v-if="timer.isPaused()"
secondary
Expand Down Expand Up @@ -63,15 +69,15 @@
@click="deleteTimer()"
>
<i-pepicons-trash class="w-4 h-4" aria-hidden="true" />
<span class="sr-only">
<span class="md:sr-only ml-1 text-xs uppercase font-medium" :class="{ 'sr-only': !timer.isPaused() }">
{{ $t('kitchen.timers.delete') }}
</span>
</CoreButton>
</div>
</div>
<div v-if="timer.hasStarted() && !timer.isOverTime()" class="mt-1 w-full h-2 rounded-full bg-gray-200 relative">
<div v-if="timer.hasStarted() && !timer.isOverTime()" class="mt-1 w-full h-2 rounded-full bg-gray-200 relative overflow-hidden">
<div
class="h-full rounded-full absolute left-0 top-0"
class="h-full absolute left-0 top-0"
:style="`width: ${(timer.duration - timer.getTimeLeft()) * 100 / timer.duration}%`"
:class="{
'bg-primary-500': !timer.isPaused(),
Expand Down
2 changes: 1 addition & 1 deletion src/routing/pages/kitchen/constants.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const KITCHEN_TRANSITION_DURATION = 600;
export const KITCHEN_TRANSITION_DURATION = 400;
4 changes: 3 additions & 1 deletion src/services/KitchenService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ export default class CookbookService extends Service<State, ComputedState, Persi
public async complete(dish: Dish): Promise<void> {
this.setState({
dishes: arrayWithout(this.dishes, dish),
timers: this.timers.filter(timer => !timer.hasDish(dish)),
timers: this.dishes.length === 0
? []
: this.timers.filter(timer => !timer.hasDish(dish)),
});

if (this.dishes.length === 0) {
Expand Down

0 comments on commit 56868e2

Please sign in to comment.