Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions frontend/src/components/layout/Panel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,14 @@ withDefaults(
overflow-y: hidden;
}
}

.panel-table > .panel-title {
padding: 1.25rem 1.25rem 0.75rem;
margin-bottom: 0;
}

.panel-table > .panel-header {
padding: 1.25rem 1.25rem 1rem;
margin-bottom: 0;
}
</style>
15 changes: 12 additions & 3 deletions frontend/src/components/layout/SidebarDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
@click="toggleMobileOpen"
>
{{ shop.nameCombined }}
{{ route.meta.title && route.name !== "account.shops.detail" ? " / " : "" }}
{{ route.meta.title }}
{{ currentRouteTitle && route.name !== "account.shops.detail" ? " / " : "" }}
{{ currentRouteTitle }}
</div>

<div ref="sidebarRef" :class="['sidebar', 'sidebar-detail', { 'mobile-open': isMobileOpen }]">
Expand Down Expand Up @@ -56,7 +56,9 @@
v-if="$router.resolve({ name: item.route }).meta.icon"
class="nav-link-icon"
/>
<span class="nav-link-name">{{ $router.resolve({ name: item.route }).meta.title }}</span>
<span class="nav-link-name">{{
$t($router.resolve({ name: item.route }).meta.titleKey ?? "")
}}</span>
<span v-if="item.count !== undefined" class="nav-link-count">{{ item.count }}</span>
</router-link>
</nav>
Expand All @@ -68,9 +70,11 @@
import type { RouterOutput } from "@/helpers/trpc";
import { computed, ref, onMounted, onUnmounted, watch } from "vue";
import { useRoute } from "vue-router";
import { useI18n } from "vue-i18n";
import StatusIcon from "@/components/StatusIcon.vue";

const route = useRoute();
const { t } = useI18n();

const isMobileOpen = ref(false);
const sidebarRef = ref<HTMLElement | null>(null);
Expand All @@ -80,6 +84,11 @@ const props = defineProps<{
shop: RouterOutput["organization"]["shop"]["get"] | null;
}>();

const currentRouteTitle = computed(() => {
const titleKey = route.meta.titleKey;
return typeof titleKey === "string" ? t(titleKey) : "";
});

const isRouteActive = (routeName: string) => {
// Exact match
if (route.name === routeName) return true;
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/composables/useShopDetail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { compareVersions } from "compare-versions";
import { trpcClient } from "@/helpers/trpc";
import type { RouterOutput } from "@/helpers/trpc";
import { useAlert } from "@/composables/useAlert";
import { i18n } from "@/i18n";

export function useShopDetail() {
const route = useRoute();
Expand Down Expand Up @@ -46,7 +47,8 @@ export function useShopDetail() {
latestShopwareVersion.value = shopwareVersions.value[0];

if (shop.value?.name) {
const pageTitle = route.meta.title;
const titleKey = route.meta.titleKey;
const pageTitle = typeof titleKey === "string" ? i18n.global.t(titleKey) : null;
document.title =
typeof pageTitle === "string"
? `${pageTitle} - ${shop.value.name} | Shopmon`
Expand Down
12 changes: 11 additions & 1 deletion frontend/src/layouts/ShopDetailLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
v-if="shop"
:breadcrumb="
shop.nameCombined +
(route.meta.title && route.name !== 'account.shops.detail' ? ' / ' + route.meta.title : '')
(currentRouteTitle && route.name !== 'account.shops.detail'
? ' / ' + currentRouteTitle
: '')
"
:title="shop.name"
:titleMobileHide="true"
Expand Down Expand Up @@ -103,6 +105,8 @@

<script setup lang="ts">
import { useRoute } from "vue-router";
import { computed } from "vue";
import { useI18n } from "vue-i18n";
import { useShopDetail } from "@/composables/useShopDetail";
import SidebarDetail from "@/components/layout/SidebarDetail.vue";
import HeaderContainer from "@/components/layout/HeaderContainer.vue";
Expand All @@ -112,6 +116,12 @@ import Modal from "@/components/layout/Modal.vue";
import FaRotate from "~icons/fa6-solid/rotate";

const route = useRoute();
const { t } = useI18n();

const currentRouteTitle = computed(() => {
const titleKey = route.meta.titleKey;
return typeof titleKey === "string" ? t(titleKey) : "";
});

const {
shop,
Expand Down
Loading