Skip to content

Commit

Permalink
chore: fixes based on comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tewshi committed Sep 27, 2023
1 parent 1fc9f2a commit fd9c8dd
Show file tree
Hide file tree
Showing 14 changed files with 80 additions and 44 deletions.
3 changes: 2 additions & 1 deletion components/account/home/AccountAddress.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const { t } = useI18n();
</script>

<template>
<div>
<div class="pt-2">
<div class="space-y-5">
<RuiTextField
id="address-1"
Expand Down Expand Up @@ -185,6 +185,7 @@ const { t } = useI18n();
type="success"
closeable
:visible="done"
:timeout="3000"
@dismiss="done = false"
>
{{ t('notifications.changes_saved') }}
Expand Down
1 change: 1 addition & 0 deletions components/account/home/AccountDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ const { t } = useI18n();
type="success"
closeable
:visible="done"
:timeout="3000"
@dismiss="done = false"
>
{{ t('notifications.changes_saved') }}
Expand Down
3 changes: 2 additions & 1 deletion components/account/home/AccountInformation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const { t } = useI18n();
</script>

<template>
<div>
<div class="pt-2">
<div class="space-y-5">
<RuiTextField
id="first-name"
Expand Down Expand Up @@ -173,6 +173,7 @@ const { t } = useI18n();
type="success"
closeable
:visible="done"
:timeout="3000"
@dismiss="done = false"
>
{{ t('notifications.changes_saved') }}
Expand Down
17 changes: 13 additions & 4 deletions components/account/home/ApiKeys.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
<script setup lang="ts">
import { storeToRefs } from 'pinia';
import { set } from '@vueuse/core';
import { useMainStore } from '~/store';
const store = useMainStore();
const { account } = storeToRefs(store);
const loading = ref(false);
const apiKey = computed(() => account.value?.apiKey ?? '');
const apiSecret = computed(() => account.value?.apiSecret ?? '');
const hasApiKeys = computed(() => apiKey.value && apiSecret.value);
const regenerateKeys = async () => await store.updateKeys();
const regenerateKeys = async () => {
set(loading, true);
await store.updateKeys();
set(loading, false);
};
const { t } = useI18n();
</script>
Expand All @@ -19,7 +26,7 @@ const { t } = useI18n();
<div class="mb-6 flex justify-between items-center">
<div class="text-h6">{{ t('account.api_keys.title') }}</div>
<div>
<RuiButton color="primary" @click="regenerateKeys()">
<RuiButton color="primary" :loading="loading" @click="regenerateKeys()">
<template #prepend>
<RuiIcon name="refresh-line" />
</template>
Expand All @@ -29,8 +36,9 @@ const { t } = useI18n();
</div>
<div class="grid md:grid-cols-2 gap-4">
<RuiRevealableTextField
id="username"
id="api-key"
:model-value="apiKey"
:disabled="loading"
variant="outlined"
:label="t('account.api_keys.api_key')"
readonly
Expand All @@ -44,8 +52,9 @@ const { t } = useI18n();
</RuiRevealableTextField>

<RuiRevealableTextField
id="username"
id="api-secret"
:model-value="apiSecret"
:disabled="loading"
variant="outlined"
:label="t('account.api_keys.api_secret')"
readonly
Expand Down
1 change: 1 addition & 0 deletions components/account/home/CancelSubscription.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ const { t } = useI18n();
<FloatingNotification
closeable
:visible="!!cancellationError"
:timeout="3000"
@close="cancellationError = ''"
>
<template #title>
Expand Down
1 change: 1 addition & 0 deletions components/account/home/ChangePassword.vue
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ const { t } = useI18n();
type="success"
closeable
:visible="success"
:timeout="3000"
@dismiss="success = false"
>
{{ t('account.change_password.message.success') }}
Expand Down
1 change: 1 addition & 0 deletions components/account/home/DangerZone.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ const { t } = useI18n();
<FloatingNotification
closeable
:visible="!!error"
:timeout="3000"
@dismiss="dismissNotification()"
>
<template #title>
Expand Down
28 changes: 25 additions & 3 deletions components/account/home/FloatingNotification.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
<script setup lang="ts">
<script lang="ts" setup>
import { get } from '@vueuse/core';
import { type ContextColorsType } from '@rotki/ui-library/dist/consts/colors';
withDefaults(
const props = withDefaults(
defineProps<{
visible: boolean;
closeable?: boolean;
timeout?: number;
type?: ContextColorsType;
}>(),
{
closeable: false,
type: 'error',
timeout: undefined,
},
);
Expand All @@ -18,6 +21,25 @@ const emit = defineEmits<{
}>();
const slots = useSlots();
const { timeout, visible } = toRefs(props);
const { stop, start, isPending } = useTimeoutFn(
() => emit('dismiss'),
() => get(timeout) ?? 0,
);
const dismiss = () => {
emit('dismiss');
get(isPending) && stop();
};
watch(visible, (show) => {
if (isDefined(get(timeout)) && show) {
get(isPending) && stop();
start();
}
});
</script>

<template>
Expand All @@ -26,7 +48,7 @@ const slots = useSlots();
v-if="visible"
class="fixed top-0 md:top-28 z-20 w-full md:bottom-auto right-0 md:right-2 md:w-[520px]"
>
<RuiAlert :type="type" :closeable="closeable" @close="emit('dismiss')">
<RuiAlert :closeable="closeable" :type="type" @close="dismiss()">
<template v-if="slots.title" #title>
<slot name="title" />
</template>
Expand Down
4 changes: 3 additions & 1 deletion components/account/home/PaymentsTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ const payments = computed(() => {
row-attr="identifier"
>
<template #item.status>
<RuiChip size="sm"> {{ t('account.payments.paid') }}</RuiChip>
<RuiChip size="sm" color="success">
{{ t('account.payments.paid') }}
</RuiChip>
</template>

<template #item.actions="{ row }">
Expand Down
55 changes: 25 additions & 30 deletions components/account/home/PremiumPlaceholder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,32 @@ const { t } = useI18n();
</script>

<template>
<div>
<RuiCard>
<div class="flex items-center space-x-4">
<div
class="rounded-full w-10 h-10 flex items-center justify-center bg-rui-primary/[0.04]"
>
<RuiLogo class="w-6 h-6" />
<RuiCard>
<div class="flex items-center space-x-4">
<div
class="rounded-full w-10 h-10 flex items-center justify-center bg-rui-primary/[0.04]"
>
<RuiLogo class="w-6 h-6" />
</div>
<div>
<div class="text-body-1">
{{ t('account.no_premium.title') }}
</div>
<div>
<div class="text-body-1">
{{ t('account.no_premium.title') }}
</div>
<div class="text-rui-text-secondary">
<i18n-t
keypath="account.no_premium.no_premium_found"
scope="global"
>
<template #plan>
<ButtonLink
inline
color="primary"
to="/checkout/plan"
class="underline"
>
{{ t('account.no_premium.plan') }}
</ButtonLink>
</template>
</i18n-t>
</div>
<div class="text-rui-text-secondary">
<i18n-t keypath="account.no_premium.no_premium_found" scope="global">
<template #plan>
<ButtonLink
inline
color="primary"
to="/checkout/plan"
class="underline"
>
{{ t('account.no_premium.plan') }}
</ButtonLink>
</template>
</i18n-t>
</div>
</div>
</RuiCard>
</div>
</div>
</RuiCard>
</template>
2 changes: 1 addition & 1 deletion components/account/home/SubscriptionTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ const displayActions = (sub: Subscription) =>
const getChipStatusColor = (status: string): ContextColorsType | undefined => {
const map: Record<string, ContextColorsType> = {
Active: 'success',
Canceled: 'error',
Cancelled: 'error',
Pending: 'warning',
'Past Due': 'warning',
};
Expand Down
2 changes: 1 addition & 1 deletion components/account/signup/SignupForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const back = () => {
set(step, Math.max(get(step) - 1, 1));
};
const next = () => {
set(step, Math.min(get(step) + 1, 4));
set(step, Math.min(get(step) + 1, steps.length));
};
const haveIntersectionKeys = (obj1: object, obj2: object) => {
Expand Down
4 changes: 3 additions & 1 deletion components/checkout/common/PaymentFrame.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ const css = useCssModule();
:title="text.title"
>
<div :class="css['action-wrapper']">
<NuxtLink :class="css.action" to="/home"> Manage Premium </NuxtLink>
<NuxtLink :class="css.action" to="/home/subscription">
Manage Premium
</NuxtLink>
</div>
</SuccessDisplay>
</div>
Expand Down
2 changes: 1 addition & 1 deletion layouts/account.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const tabModelValue = ref();
</RuiTabs>
</div>

<div class="flex-1 overflow-x-auto pt-2">
<div class="flex-1 overflow-x-auto">
<slot />
</div>
</div>
Expand Down

0 comments on commit fd9c8dd

Please sign in to comment.