-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
173 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './ui' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './var-dump-page' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as VarDumpPage } from './var-dump-page.vue'; |
18 changes: 18 additions & 0 deletions
18
src/screens/var-dump/ui/var-dump-page/var-dump-page.stories.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import type { Meta, StoryObj } from "@storybook/vue3"; | ||
import { useVarDump } from "~/src/entities/var-dump"; | ||
import { varDumpObjectMock } from '~/src/entities/var-dump/mocks'; | ||
import VarDump from './var-dump-page.vue'; | ||
|
||
const { normalizeVarDumpEvent } = useVarDump(); | ||
|
||
export default { | ||
title: "Screens/VarDump/VarDumpPage", | ||
component: VarDump | ||
} as Meta<typeof VarDump>; | ||
|
||
|
||
export const Default: StoryObj<typeof VarDump> = { | ||
args: { | ||
event: normalizeVarDumpEvent(varDumpObjectMock), | ||
} | ||
} |
114 changes: 114 additions & 0 deletions
114
src/screens/var-dump/ui/var-dump-page/var-dump-page.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
<script lang="ts" setup> | ||
import moment from "moment/moment"; | ||
import { computed } from "vue"; | ||
import type { VarDump } from "~/src/entities/var-dump/types"; | ||
import type { NormalizedEvent } from "~/src/shared/types"; | ||
import { TableBase, TableBaseRow, ValueDump } from "~/src/shared/ui"; | ||
type Props = { | ||
event: NormalizedEvent<VarDump>; | ||
}; | ||
const props = defineProps<Props>(); | ||
const title = computed(() => { | ||
const type = String(props.event.payload.payload.type || "Unknown type"); | ||
return type[0].toUpperCase() + type.slice(1); | ||
}); | ||
const date = computed(() => | ||
moment(props.event.date).format("DD.MM.YYYY HH:mm:ss") | ||
); | ||
</script> | ||
|
||
<template> | ||
<div ref="main" class="var-dump"> | ||
<main class="var-dump__in"> | ||
<header class="var-dump__header"> | ||
<h2 class="var-dump__header-title"> | ||
{{ title }} | ||
</h2> | ||
<div class="var-dump__header-meta"> | ||
<span class="var-dump__header-date">{{ date }}</span> | ||
</div> | ||
</header> | ||
|
||
<section class="var-dump__body"> | ||
<ValueDump | ||
:value="event.payload.payload.value" | ||
:type="event.payload.payload.type" | ||
/> | ||
</section> | ||
|
||
<section class="var-dump__body"> | ||
<h3 class="var-dump__body-text">Source</h3> | ||
<TableBase class="var-dump__body-table"> | ||
<TableBaseRow | ||
v-for="(value, name) in event.payload.context.source" | ||
:key="name" | ||
:title="String(name)" | ||
> | ||
{{ value }} | ||
</TableBaseRow> | ||
</TableBase> | ||
</section> | ||
|
||
<section class="var-dump__body"> | ||
<h3 class="var-dump__body-text">Request</h3> | ||
<TableBase class="var-dump__body-table"> | ||
<template | ||
v-for="(value, name) in event.payload.context.request" | ||
:key="name" | ||
> | ||
<TableBaseRow v-if="name && value" :title="String(name)"> | ||
{{ value }} | ||
</TableBaseRow> | ||
</template> | ||
</TableBase> | ||
</section> | ||
</main> | ||
</div> | ||
</template> | ||
|
||
<style lang="scss" scoped> | ||
@import "src/assets/mixins"; | ||
.var-dump { | ||
@apply relative; | ||
} | ||
.var-dump__in { | ||
@apply flex flex-col h-full flex-grow py-5 px-4 md:px-6 lg:px-8; | ||
} | ||
.var-dump__header { | ||
@apply flex flex-col md:flex-row justify-between items-center mb-5; | ||
} | ||
.var-dump__header-meta { | ||
@apply flex flex-col md:flex-row items-center gap-x-5; | ||
} | ||
.var-dump__header-title { | ||
@apply text-sm sm:text-base md:text-lg lg:text-2xl; | ||
} | ||
.var-dump__header-date { | ||
@include text-muted; | ||
@apply text-sm font-semibold; | ||
} | ||
.var-dump__body { | ||
@apply py-5; | ||
} | ||
.var-dump__body-text { | ||
@include text-muted; | ||
@apply font-bold uppercase text-sm mb-5; | ||
} | ||
.var-dump__body-table { | ||
@apply mt-3; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters