Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove locking #28

Merged
merged 15 commits into from
Jan 23, 2024
25 changes: 25 additions & 0 deletions cypress/e2e/schedule.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,29 @@ describe('Schedule tests', () => {
cy.getByTestId('week-0-calendar-tab-2').click();
cy.get('.training-card').should('exist');
});

it('resets schedule', () => {
cy.visit('/').getByTestId('navbar-schedule-link').click();
cy.getByTestId('schedule-settings-start-of-week-sunday')
cy.addTraining();
cy.getByTestId('schedule-settings-reset-button').click();
cy.getByTestId('confirm-dialog-confirm-button').click();
cy.location('pathname').should('eq', '/getfit/');
cy.getByTestId('navbar-schedule-link').click();
cy.getByTestId('schedule-settings-start-of-week-sunday').should('not.be.selected');
cy.getByTestId('week-0').should('not.exist');
});

it('resets schedule from print view', () => {
cy.visit('/').getByTestId('navbar-schedule-link').click();
cy.getByTestId('schedule-settings-start-of-week-sunday')
cy.addTraining();
cy.getByTestId('navbar-print-link').click();
cy.getByTestId('print-view-reset-button').click();
cy.getByTestId('confirm-dialog-confirm-button').click();
cy.location('pathname').should('eq', '/getfit/');
cy.getByTestId('navbar-schedule-link').click();
cy.getByTestId('schedule-settings-start-of-week-sunday').should('not.be.selected');
cy.getByTestId('week-0').should('not.exist');
});
});
414 changes: 210 additions & 204 deletions package-lock.json

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,47 +19,47 @@
"@mdi/font": "^7.4.47",
"@vuelidate/core": "^2.0.3",
"@vuelidate/validators": "^2.0.4",
"@vuepic/vue-datepicker": "^7.4.0",
"@vueuse/core": "^10.7.1",
"@vuepic/vue-datepicker": "^7.4.1",
"@vueuse/core": "^10.7.2",
"ics": "^3.7.2",
"luxon": "^3.4.4",
"pinia": "^2.1.7",
"ramda": "^0.29.1",
"resize-observer-polyfill": "^1.5.1",
"uuid": "^9.0.1",
"vue": "^3.4.3",
"vue-i18n": "^9.8.0",
"vue": "^3.4.15",
"vue-i18n": "^9.9.0",
"vue-router": "^4.2.5",
"vuedraggable": "^4.1.0",
"vuetify": "3.4.9"
"vuetify": "3.5.1"
},
"devDependencies": {
"@pinia/testing": "^0.1.3",
"@rushstack/eslint-patch": "^1.6.1",
"@rushstack/eslint-patch": "^1.7.0",
"@tsconfig/node18": "^18.2.2",
"@types/jsdom": "^21.1.6",
"@types/luxon": "^3.3.7",
"@types/node": "^20.10.6",
"@types/ramda": "^0.29.9",
"@types/luxon": "^3.4.2",
"@types/node": "^20.11.5",
"@types/ramda": "^0.29.10",
"@types/uuid": "^9.0.7",
"@vitejs/plugin-vue": "^5.0.2",
"@vitejs/plugin-vue": "^5.0.3",
"@vue/eslint-config-prettier": "^9.0.0",
"@vue/eslint-config-typescript": "^12.0.0",
"@vue/test-utils": "^2.4.3",
"@vue/tsconfig": "^0.5.1",
"cypress": "^13.6.2",
"cypress": "^13.6.3",
"eslint": "^8.56.0",
"eslint-plugin-cypress": "^2.15.1",
"eslint-plugin-vue": "^9.19.2",
"jsdom": "^23.0.1",
"eslint-plugin-vue": "^9.20.1",
"jsdom": "^24.0.0",
"npm-run-all2": "^6.1.1",
"prettier": "^3.1.1",
"sass": "^1.69.6",
"prettier": "^3.2.4",
"sass": "^1.70.0",
"start-server-and-test": "^2.0.3",
"typescript": "^5.3.3",
"vite": "^5.0.10",
"vite": "^5.0.12",
"vite-plugin-vuetify": "^2.0.1",
"vitest": "^1.1.1",
"vitest": "^1.2.1",
"vue-tsc": "^1.8.27"
},
"engines": {
Expand Down
2 changes: 2 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {RouterView} from 'vue-router';
import {useI18n} from 'vue-i18n';
import useScreenSize from '@/hooks/screenSize';
import {useScheduleStore} from '@/stores/schedule';
import ConfirmDialog from '@/components/ConfirmDialog.vue';

const {weeks} = storeToRefs(useScheduleStore());
const {isSmallScreen} = useScreenSize();
Expand Down Expand Up @@ -58,6 +59,7 @@ const {t} = useI18n();
</v-btn>
</v-bottom-navigation>
</div>
<ConfirmDialog />
</v-app>
</template>
<style lang="scss" scoped>
Expand Down
32 changes: 32 additions & 0 deletions src/components/BaseDialog.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<script setup lang="ts">
import useScreenSize from '@/hooks/screenSize';

withDefaults(defineProps<{
open: boolean;
title: string;
useFullScreen?: boolean;
}>(), {
useFullScreen: true,
});

const {isSmallScreen} = useScreenSize();
</script>
<template>
<v-dialog
:model-value="open"
:width="!isSmallScreen ? 'auto' : undefined"
:fullscreen="useFullScreen && isSmallScreen"
:transition="isSmallScreen ? 'dialog-bottom-transition' : false"
:min-width="!isSmallScreen ? 500 : undefined"
persistent
>
<v-card>
<v-card-title>{{ title }}</v-card-title>
<v-card-text>
<slot name="content" />
</v-card-text>
<v-card-actions><slot name="actions" /></v-card-actions>
</v-card>
</v-dialog>
</template>
<style lang="scss" scoped></style>
33 changes: 33 additions & 0 deletions src/components/ConfirmDialog.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<script setup lang="ts">
import {storeToRefs} from 'pinia';
import {useAppStateStore} from '@/stores/appState';
import BaseDialog from '@/components/BaseDialog.vue';

const appStateStore = useAppStateStore();
const {confirmDialogOpen, confirmText, confirmAction} = storeToRefs(appStateStore);
</script>
<template>
<BaseDialog
:open="confirmDialogOpen"
:use-full-screen="false"
:title="$t('general.confirmTitle')"
>
<template #content>{{ confirmText }}</template>
<template #actions>
<v-btn
color="primary"
variant="outlined"
prepend-icon="mdi-check"
data-test-id="confirm-dialog-confirm-button"
@click="confirmAction(), (confirmDialogOpen = false)"
>{{ $t('general.confirm') }}</v-btn
>
<v-btn
prepend-icon="mdi-close"
data-test-id="confirm-dialog-cancel-button"
@click="confirmDialogOpen = false"
>{{ $t('general.cancel') }}</v-btn
>
</template>
</BaseDialog>
</template>
Loading