Skip to content

Commit

Permalink
[#58] update setup script for layout
Browse files Browse the repository at this point in the history
  • Loading branch information
Kreezag committed Mar 3, 2024
1 parent 3a38f6b commit 0e73b57
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 46 deletions.
82 changes: 37 additions & 45 deletions layouts/default.vue
Original file line number Diff line number Diff line change
@@ -1,65 +1,57 @@
<template>
<div class="main-layout">
<LayoutSidebar
class="main-layout__sidebar"
:api-version="apiVersion"
:client-version="clientVersion"
/>

<div class="main-layout__content">
<slot />
</div>
</div>
</template>

<script lang="ts">
import { storeToRefs } from "pinia";
import { defineComponent } from "vue";
<script lang="ts" setup>
import { computed, ref, onMounted } from "vue";
import { LayoutSidebar } from "~/src/widgets/ui";
import { useEvents } from "~/src/shared/lib/use-events";
import { useSettings } from "~/src/shared/lib/use-settings";
import SfdumpWrap from "~/src/shared/lib/vendor/dumper";
import { version } from "../package.json";
import { useSettingsStore } from "~/stores/settings";
export default defineComponent({
components: {
LayoutSidebar,
},
async setup() {
SfdumpWrap(window.document);
SfdumpWrap(window.document);
useSettingsStore();
const settingsStore = useSettingsStore();
const { themeType, isFixedHeader } = storeToRefs(settingsStore);
const {
api: { getVersion },
} = useSettings();
const {
api: { getVersion },
} = useSettings();
const apiVersion = ref("");
const clientVersion = ref(
!version || version === "0.0.1" ? "@dev" : `v${version}`
);
const apiVersion = await getVersion();
const getApiVersion = async () => {
const data = await getVersion();
const { events } = useEvents();
apiVersion.value = String(data).match(/^[0-9.]+.*$/)
? `v${data}`
: `@${data}`;
};
if (!events?.items?.value?.length) {
events.getAll();
}
onMounted(() => {
getApiVersion();
const clientVersion =
!version || version === "0.0.1" ? "@dev" : `v${version}`;
const { events } = useEvents();
return {
themeType,
isFixedHeader,
apiVersion: String(apiVersion).match(/^[0-9.]+.*$/)
? `v${apiVersion}`
: `@${apiVersion}`,
clientVersion,
};
},
if (!events?.items?.value?.length) {
events.getAll();
}
});
</script>

<template>
<div class="main-layout">
<LayoutSidebar
class="main-layout__sidebar"
:api-version="apiVersion"
:client-version="clientVersion"
/>

<div class="main-layout__content">
<slot />
</div>
</div>
</template>

<style lang="scss" scoped>
@import "assets/mixins";
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/ui/page-layout/page-layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const allEvents = computed(() => {
});
useHead({
title: `${props.title} > ${allEvents.value.length} | Buggregator`,
title: `${props.title || "Events"}: ${allEvents.value.length} | Buggregator`,
});
const visibleEvents = computed(() => {
Expand Down

0 comments on commit 0e73b57

Please sign in to comment.