Skip to content

Commit

Permalink
Merge branch 'main' into fix/select-fields-view
Browse files Browse the repository at this point in the history
  • Loading branch information
letehaha authored Dec 19, 2024
2 parents bb33f84 + 7f70102 commit f27a52a
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 10 deletions.
8 changes: 5 additions & 3 deletions src/components/common/alert-dialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ defineEmits(["accept", "cancel"]);
withDefaults(
defineProps<{
title: string;
description?: string;
description?: string; // "description" slot can be used to pass template
cancelLabel?: string;
acceptLabel?: string;
acceptVariant?: ButtonVariantProps["variant"];
Expand Down Expand Up @@ -34,8 +34,10 @@ withDefaults(
{{ title }}
</AlertDialog.AlertDialogTitle>

<AlertDialog.AlertDialogDescription v-if="description">
{{ description }}
<AlertDialog.AlertDialogDescription v-if="description || $slots.description">
<slot name="description">
{{ description }}
</slot>
</AlertDialog.AlertDialogDescription>

<slot name="content" />
Expand Down
10 changes: 9 additions & 1 deletion src/components/dialogs/monobank-set-token.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,15 @@ const submit = async () => {
<form class="grid gap-6" data-cy="monobank-set-token-modal" @submit.prevent="submit">
<p>
Please visit
<a href="https://api.monobank.ua/" class="text-primary">https://api.monobank.ua/</a>
<a
href="https://api.monobank.ua/"
target="_blank"
rel="noopener noreferrer"
class="text-primary"
>
https://api.monobank.ua/
</a>

and follow all the instructions. Paste the API token from Monobank in the field below
</p>
<div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui-header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

<router-link :to="{ name: ROUTES_NAMES.settings }">
<ui-button variant="secondary" class="text-white" size="icon" as="span">
<SettingsIcon />
<SettingsIcon :color="currentTheme === Themes.light ? 'black' : undefined" />
</ui-button>
</router-link>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/account/account.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<MonobankAccount :account="account" />
</template>
<template v-else-if="account.type === ACCOUNT_TYPES.system">
<SystemAccount :account="account" />
<SystemAccount :account="account" :transactions="rawTransactionsList" />
</template>
</Card.CardContent>
</Card.Card>
Expand Down
5 changes: 4 additions & 1 deletion src/pages/account/create.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<template>
<div class="p-6">
<CreateAccountForm class="max-w-[440px]" @created="pushToAccountsPage" />
<Card class="sticky h-min w-[440px] top-[var(--header-height)] p-4">
<CreateAccountForm class="max-w-[440px]" @created="pushToAccountsPage" />
</Card>
</div>
</template>

Expand All @@ -9,6 +11,7 @@ import { useRouter } from "vue-router";
import { ROUTES_NAMES } from "@/routes/constants";
import CreateAccountForm from "@/components/forms/create-account-form.vue";
import { Card } from "@/components/lib/ui/card";
const router = useRouter();
const pushToAccountsPage = () => {
Expand Down
21 changes: 18 additions & 3 deletions src/pages/account/types/system/system.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { ref } from "vue";
import { ref, computed } from "vue";
import { useRouter } from "vue-router";
import { AccountModel } from "shared-types";
import { AccountModel, TransactionModel } from "shared-types";
import { useAccountsStore } from "@/stores";
import { ROUTES_NAMES } from "@/routes";
Expand All @@ -18,12 +18,14 @@ import SettingAccountGroup from "@/pages/account/components/account-group.vue";
const props = defineProps<{
account: AccountModel;
transactions: TransactionModel[];
}>();
const router = useRouter();
const { addSuccessNotification, addErrorNotification } = useNotificationCenter();
const accountsStore = useAccountsStore();
const confirmAccountName = ref("");
const accountHasTransactions = computed(() => props.transactions.length > 0);
const deleteAccount = async () => {
const accountName = props.account.name;
Expand Down Expand Up @@ -77,14 +79,27 @@ const deleteAccount = async () => {

<AlertDialog
title="Are you absolutely sure?"
description="This action cannot be undone. This will permanently delete your account and remove your data from our servers."
:accept-disabled="confirmAccountName !== account.name"
accept-variant="destructive"
@accept="deleteAccount"
>
<template #trigger>
<Button variant="destructive"> Delete this account </Button>
</template>
<template #description>
<template v-if="accountHasTransactions">
This action cannot be undone.
<strong>
You have {{ transactions.length }} transactions associated with this account,
they will also be deleted.
</strong>
Do you really want to delete this account?
</template>
<template v-else>
This action cannot be undone. Do you really want to delete this account?
<strong> You have zero transactions associated. </strong>
</template>
</template>
<template #content>
<InputField
v-model="confirmAccountName"
Expand Down

0 comments on commit f27a52a

Please sign in to comment.