Skip to content

Commit

Permalink
Merge pull request #2754 from p0lycarpio/fixes/ui-improvements
Browse files Browse the repository at this point in the history
fix: frontend improvements
  • Loading branch information
boc-the-git authored Nov 26, 2023
2 parents 435b66c + 421f718 commit 340841b
Show file tree
Hide file tree
Showing 12 changed files with 58 additions and 43 deletions.
2 changes: 1 addition & 1 deletion frontend/components/Domain/Recipe/RecipeAssets.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div v-if="value.length > 0 || edit">
<v-card class="mt-2">
<v-card class="mt-4">
<v-card-title class="py-2">
{{ $t("asset.assets") }}
</v-card-title>
Expand Down
4 changes: 1 addition & 3 deletions frontend/components/Domain/Recipe/RecipeIngredientEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
solo
hide-details
dense
class="mx-1"
type="number"
:placeholder="$t('recipe.quantity')"
@keypress="quantityFilter"
Expand Down Expand Up @@ -89,7 +88,6 @@
hide-details
dense
solo
class="mx-1"
:placeholder="$t('recipe.notes')"
@click="$emit('clickIngredientField', 'note')"
>
Expand All @@ -100,7 +98,7 @@
<BaseButtonGroup
hover
:large="false"
class="my-auto"
class="my-auto d-flex"
:buttons="btns"
@toggle-section="toggleTitle"
@toggle-original="toggleOriginalText"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<v-card outlined class="flex-grow-1">
<v-card-text class="pa-3 pb-0">
<p class="">{{ comment.user.username }} • {{ $d(Date.parse(comment.createdAt), "medium") }}</p>
{{ comment.text }}
<SafeMarkdown :source="comment.text" />
</v-card-text>
<v-card-actions class="justify-end mt-0 pt-0">
<v-btn
Expand All @@ -60,11 +60,13 @@ import { Recipe, RecipeCommentOut } from "~/lib/api/types/recipe";
import UserAvatar from "~/components/Domain/User/UserAvatar.vue";
import { NoUndefinedField } from "~/lib/api/types/non-generated";
import { usePageUser } from "~/composables/recipe-page/shared-state";
import SafeMarkdown from "~/components/global/SafeMarkdown.vue";
export default defineComponent({
components: {
UserAvatar,
},
SafeMarkdown
},
props: {
recipe: {
type: Object as () => NoUndefinedField<Recipe>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
</v-btn>
</v-card-actions>
<AdvancedOnly>
<v-card v-if="isEditForm" flat class="ma-2 mb-2">
<v-card v-if="isEditForm" flat class="mb-2 mx-n2">
<v-card-title> {{ $t('recipe.api-extras') }} </v-card-title>
<v-divider class="mx-2"></v-divider>
<v-divider class="ml-4"></v-divider>
<v-card-text>
{{ $t('recipe.api-extras-description') }}
<v-row v-for="(_, key) in recipe.extras" :key="key" class="mt-1">
<v-col cols="8">
<v-col style="max-width: 400px;">
<v-text-field v-model="recipe.extras[key]" dense :label="key">
<template #prepend>
<v-btn color="error" icon class="mt-n4" @click="removeApiExtra(key)">
Expand All @@ -41,8 +41,8 @@
</v-col>
</v-row>
</v-card-text>
<v-card-actions class="d-flex">
<div style="max-width: 200px">
<v-card-actions class="d-flex ml-2 mt-n3">
<div>
<v-text-field v-model="apiNewKey" :label="$t('recipe.message-key')"></v-text-field>
</div>
<BaseButton create small class="ml-5" @click="createApiExtra" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</TransitionGroup>
</draggable>
<v-skeleton-loader v-else boilerplate elevation="2" type="list-item"> </v-skeleton-loader>
<div class="d-flex flex-wrap justify-center justify-sm-end mt-2">
<div class="d-flex flex-wrap justify-center justify-sm-end mt-3">
<v-tooltip top color="accent">
<template #activator="{ on, attrs }">
<span v-on="on">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@
<v-card-actions>
<BaseButton cancel @click="dialog = false"> </BaseButton>
<v-spacer></v-spacer>
<BaseButton color="info" @click="autoSetReferences">
<template #icon> {{ $globals.icons.robot }}</template>
{{ $t("recipe.auto") }}
</BaseButton>
<BaseButton save @click="setIngredientIds"> </BaseButton>
<div class="d-flex flex-wrap justify-end">
<BaseButton color="info" @click="autoSetReferences">
<template #icon> {{ $globals.icons.robot }}</template>
{{ $t("recipe.auto") }}
</BaseButton>
<BaseButton class="ml-2" save @click="setIngredientIds"> </BaseButton>
</div>
</v-card-actions>
</v-card>
</v-dialog>
Expand Down Expand Up @@ -84,7 +86,7 @@
<div v-for="(step, index) in value" :key="step.id" class="list-group-item">
<v-app-bar
v-if="step.id && showTitleEditor[step.id]"
class="primary mx-1 mt-6"
class="primary mt-6"
style="cursor: pointer"
dark
dense
Expand Down Expand Up @@ -219,6 +221,7 @@
</div>
</TransitionGroup>
</draggable>
<v-divider class="mt-10 d-flex d-md-none"/>
</section>
</template>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div>
<!-- Recipe Categories -->
<v-card v-if="recipe.recipeCategory.length > 0 || isEditForm" class="mt-2">
<v-card v-if="recipe.recipeCategory.length > 0 || isEditForm" :class="{'mt-10': !isEditForm}">
<v-card-title class="py-2">
{{ $t("recipe.categories") }}
</v-card-title>
Expand All @@ -19,7 +19,7 @@
</v-card>

<!-- Recipe Tags -->
<v-card v-if="recipe.tags.length > 0 || isEditForm" class="mt-2">
<v-card v-if="recipe.tags.length > 0 || isEditForm" class="mt-4">
<v-card-title class="py-2">
{{ $t("tag.tags") }}
</v-card-title>
Expand All @@ -45,7 +45,7 @@
</v-card-text>
</v-card>

<RecipeNutrition v-if="recipe.settings.showNutrition" v-model="recipe.nutrition" class="mt-10" :edit="isEditForm" />
<RecipeNutrition v-if="recipe.settings.showNutrition" v-model="recipe.nutrition" class="mt-4" :edit="isEditForm" />
<RecipeAssets
v-if="recipe.settings.showAssets"
v-model="recipe.assets"
Expand Down
4 changes: 2 additions & 2 deletions frontend/components/Domain/Recipe/RecipeTimeline.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</v-btn>
</v-col>
</v-row>
<v-divider class="mx-2" />
<v-divider class="mx-2"/>
<div
v-if="timelineEvents.length"
id="timeline-container"
Expand All @@ -34,7 +34,7 @@
{{ $t("recipe.timeline-is-empty") }}
</v-card-title>
</v-card>
<div v-if="loading" class="mb-3">
<div v-if="loading" class="mb-3 text-center">
<AppLoader :loading="loading" :waiting-text="$tc('general.loading-events')" />
</div>
</div>
Expand Down
5 changes: 3 additions & 2 deletions frontend/components/Domain/Recipe/RecipeTimelineItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
@error="hideImage = true"
/>
<div v-if="event.eventMessage" :class="useMobileFormat ? 'text-caption' : ''">
{{ event.eventMessage }}
<SafeMarkdown :source="event.eventMessage" />
</div>
</v-col>
</v-row>
Expand All @@ -101,9 +101,10 @@ import RecipeTimelineContextMenu from "./RecipeTimelineContextMenu.vue";
import { useStaticRoutes } from "~/composables/api";
import { Recipe, RecipeTimelineEventOut } from "~/lib/api/types/recipe"
import UserAvatar from "~/components/Domain/User/UserAvatar.vue";
import SafeMarkdown from "~/components/global/SafeMarkdown.vue";
export default defineComponent({
components: { RecipeCardMobile, RecipeTimelineContextMenu, UserAvatar },
components: { RecipeCardMobile, RecipeTimelineContextMenu, UserAvatar, SafeMarkdown },
props: {
event: {
Expand Down
44 changes: 28 additions & 16 deletions frontend/pages/admin/backups.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<template>
<v-container fluid>
<BannerExperimental issue="https://github.com/hay-kot/mealie/issues/871"></BannerExperimental>
<section>
<!-- Delete Dialog -->
<BaseDialog
Expand Down Expand Up @@ -44,14 +43,15 @@
></v-checkbox>
</v-card-text>
<v-card-actions class="justify-center pt-0">
<BaseButton delete :disabled="!confirmImport" @click="restoreBackup(selected)">
<BaseButton delete :disabled="!confirmImport || runningRestore" @click="restoreBackup(selected)">
<template #icon> {{ $globals.icons.database }} </template>
{{ $t('settings.backup.restore-backup') }}
</BaseButton>
</v-card-actions>
<p class="caption pb-0 mb-1 text-center">
{{ selected }}
</p>
<v-progress-linear v-if="runningRestore" indeterminate></v-progress-linear>
</BaseDialog>

<section>
Expand All @@ -60,7 +60,16 @@
<i18n path="settings.backup.experimental-description" />
</v-card-text>
</BaseCardSectionTitle>
<BaseButton @click="createBackup"> {{ $t("settings.backup.create-heading") }} </BaseButton>
<v-toolbar color="background" flat class="justify-between">
<BaseButton class="mr-2" @click="createBackup"> {{ $t("settings.backup.create-heading") }} </BaseButton>
<AppButtonUpload
:text-btn="false"
url="/api/admin/backups/upload"
accept=".zip"
color="info"
@uploaded="refreshBackups()"
/>
</v-toolbar>

<v-data-table
:headers="headers"
Expand All @@ -86,20 +95,17 @@
>
<v-icon> {{ $globals.icons.delete }} </v-icon>
</v-btn>
<BaseButton small download :download-url="backupsFileNameDownload(item.name)" @click.stop="() => {}" />
<BaseButton small download :download-url="backupsFileNameDownload(item.name)" class="mx-1" @click.stop="() => {}"/>
<BaseButton small @click.stop="setSelected(item); importDialog = true">
<template #icon> {{ $globals.icons.backupRestore }}</template>
{{ $t("settings.backup.backup-restore") }}
</BaseButton>
</template>
</v-data-table>
<v-divider></v-divider>
<div class="d-flex justify-end mt-6">
<div>
<AppButtonUpload
:text-btn="false"
class="mr-4"
url="/api/admin/backups/upload"
accept=".zip"
color="info"
@uploaded="refreshBackups()"
/>

</div>
</div>
</section>
Expand All @@ -114,6 +120,7 @@
import { computed, defineComponent, reactive, ref, toRefs, useContext, onMounted, useRoute } from "@nuxtjs/composition-api";
import { useAdminApi } from "~/composables/api";
import { AllBackups } from "~/lib/api/types/admin";
import { alert } from "~/composables/use-toast";
export default defineComponent({
layout: "admin",
Expand Down Expand Up @@ -142,19 +149,23 @@ export default defineComponent({
if (!data?.error) {
refreshBackups();
alert.success(i18n.tc("settings.backup.backup-created"));
} else {
alert.error(i18n.tc("settings.backup.error-creating-backup-see-log-file"));
}
}
async function restoreBackup(fileName: string) {
state.runningRestore = true;
const { error } = await adminApi.backups.restore(fileName);
if (error) {
console.log(error);
state.importDialog = false;
return;
} else {
alert.success(i18n.tc("settings.backup.restore-success"));
$auth.logout();
}
$auth.logout();
}
const deleteTarget = ref("");
Expand All @@ -163,6 +174,7 @@ export default defineComponent({
const { data } = await adminApi.backups.delete(deleteTarget.value);
if (!data?.error) {
alert.success(i18n.tc("settings.backup.backup-deleted"));
refreshBackups();
}
}
Expand All @@ -172,6 +184,7 @@ export default defineComponent({
deleteDialog: false,
createDialog: false,
importDialog: false,
runningRestore: false,
search: "",
headers: [
{ text: i18n.t("general.name"), value: "name" },
Expand All @@ -186,7 +199,6 @@ export default defineComponent({
return;
}
selected.value = data.name;
state.importDialog = true;
}
const backupsFileNameDownload = (fileName: string) => `api/admin/backups/${fileName}`;
Expand Down
2 changes: 1 addition & 1 deletion frontend/pages/g/_groupSlug/recipes/timeline.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<v-sheet :class="$vuetify.breakpoint.smAndDown ? 'pa-0' : 'px-3 py-0'">
<BasePageTitle v-if="groupName" divider>
<BasePageTitle v-if="groupName">
<template #header>
<v-img max-height="200" max-width="150" :src="require('~/static/svgs/manage-members.svg')" />
</template>
Expand Down
1 change: 0 additions & 1 deletion frontend/pages/user/profile/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<h2 class="headline">{{ $t('profile.welcome-user', [user.fullName]) }}</h2>
<p class="subtitle-1 mb-0 text-center">
{{ $t('profile.description') }}
<a href="https://hay-kot.github.io/mealie/" target="_blank"> {{ $t('general.learn-more') }} </a>
</p>
<v-card flat color="background" width="100%" max-width="600px">
<v-card-actions class="d-flex justify-center my-4">
Expand Down

0 comments on commit 340841b

Please sign in to comment.