Skip to content

Commit

Permalink
fix ray exception component view
Browse files Browse the repository at this point in the history
  • Loading branch information
Kreezag committed Sep 22, 2024
1 parent d3f6575 commit 8cb9b23
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 14 deletions.
31 changes: 19 additions & 12 deletions src/entities/ray/ui/ray-exception/ray-exception.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
<script lang="ts" setup>
import type { RayContentException } from "../../types";
import { RayFile } from "../ray-file";
import { computed, defineProps, withDefaults } from 'vue'
import type { RayContentException } from '../../types'
import { RayFile } from '../ray-file'
const RAY_MAX_EXCEPTION_FRAMES = 10
type Props = {
exception: RayContentException;
};
exception: RayContentException
maxFrames?: number
}
const props = withDefaults(defineProps<Props>(), {
maxFrames: 0
})
const exceptionFrames = computed(() => {
const frames = props.exception.frames || []
defineProps<Props>();
return frames.slice(0 - RAY_MAX_EXCEPTION_FRAMES).reverse()
})
</script>

<template>
Expand All @@ -22,18 +34,13 @@ defineProps<Props>();
</header>

<div class="ray-exception__files">
<RayFile
v-for="(file, i) in exception.frames"
:key="i"
:file="file"
:collapsed="i !== 0"
/>
<RayFile v-for="(file, i) in exceptionFrames" :key="i" :file="file" :is-open="i !== 0" />
</div>
</div>
</template>

<style lang="scss" scoped>
@import "src/assets/mixins";
@import 'src/assets/mixins';
.ray-exception {
@apply flex flex-col;
}
Expand Down
7 changes: 5 additions & 2 deletions src/entities/ray/ui/ray-file/ray-file.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ import type { RayFrame } from '../../types'
type Props = {
file: RayFrame
isOpen?: boolean
}
const props = defineProps<Props>()
const props = withDefaults(defineProps<Props>(), {
isOpen: false
})
const collapsed = ref(true)
const collapsed = ref(props.isOpen)
const hasSnippets = computed(() => (props.file.snippet ? props.file.snippet.length > 0 : false))
</script>
Expand Down

0 comments on commit 8cb9b23

Please sign in to comment.