-
Notifications
You must be signed in to change notification settings - Fork 2
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
10 changed files
with
1,055 additions
and
384 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<template> | ||
<div v-if="body.length" class="markdown"> | ||
<MarkdownHTML> | ||
{{ body }} | ||
</MarkdownHTML> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
const props = defineProps({ | ||
model: { type: Object, required: true } | ||
}); | ||
const body = computed(() => { | ||
return [ props.model.pr.body, props.model.review.body ] | ||
.filter(x => x && x.length > 0) | ||
.join("\n\n---\n\n"); | ||
}); | ||
</script> |
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,28 @@ | ||
<template> | ||
<div> | ||
<ComponentCard :badge="idx" title-class=""> | ||
<template #title> | ||
<code>{{ comment.path }}</code> | ||
</template> | ||
<template #body> | ||
<div class="overflow-scroll text-lg max-h-[70vh]"> | ||
<DiffBlock :comment="comment" /> | ||
</div> | ||
</template> | ||
</ComponentCard> | ||
<div class="max-w-2xl mx-auto text-center"> | ||
<MarkdownHTML>{{ commentBody }}</MarkdownHTML> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
const props = defineProps({ | ||
comment: { type: Object, required: true }, | ||
idx: { type: Number, required: true } | ||
}); | ||
const commentBody = computed(() => { | ||
return props.comment.body.replace(/^\s*\d+\.\s*/, ''); | ||
}); | ||
</script> |
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,87 @@ | ||
<template> | ||
<div class="flex flex-col h-full" @keyup.left="left"> | ||
<div class="flex-grow" /> | ||
<div class="flex-0"> | ||
<div v-if="current==0"> | ||
<div class="text-6xl font-extrabold text-center"> | ||
<span>(#{{ model.pr.number }})</span> | ||
<GradientText>{{ model.pr.title }}</GradientText> | ||
</div> | ||
<div class="mx-auto w-1/2 mt-8"> | ||
<Review-MetadataList :model="model" /> | ||
</div> | ||
</div> | ||
|
||
<div v-if="current===1"> | ||
<ComponentCard> | ||
<template #title> | ||
<div class="text-xl font-extrabold"> | ||
<span>(#{{ model.pr.number }})</span> | ||
<GradientText>{{ model.pr.title }}</GradientText> | ||
</div> | ||
</template> | ||
<template #body> | ||
<div class="px-4 py-4"> | ||
<BodyMarkdown :model="model" /> | ||
</div> | ||
</template> | ||
</ComponentCard> | ||
</div> | ||
|
||
<div v-for="(c, i) in model.comments" :key="i"> | ||
<SlideCard | ||
v-if="i+2==current" :comment="c" | ||
:idx="i+1" | ||
/> | ||
</div> | ||
|
||
<div v-if="current===model.comments.length+2" class="text-center font-bold"> | ||
FIN | ||
</div> | ||
</div> | ||
<div class="flex-grow" /> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
const props = defineProps({ | ||
model: { type: Object, required: true } | ||
}); | ||
function onKeyUp(e) { | ||
if (e.defaultPrevented) { | ||
return; | ||
} | ||
const totalSlides = props.model.comments.length + 3; | ||
let next = current.value; | ||
switch (e.key) { | ||
case "ArrowLeft": | ||
next = (next - 1) % totalSlides; | ||
break; | ||
case "ArrowRight": | ||
case "Space": | ||
next = (next + 1) % totalSlides; | ||
break; | ||
} | ||
if (next < 0) { | ||
next = totalSlides - 1; | ||
} | ||
current.value = next; | ||
} | ||
onMounted(() => { | ||
window.addEventListener('keyup', onKeyUp); | ||
}); | ||
onUnmounted(() => { | ||
window.removeEventListener('keyup', onKeyUp); | ||
}); | ||
const current = ref(0); | ||
</script> |
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
File renamed without changes.
42 changes: 42 additions & 0 deletions
42
frontend/pages/[org]/[repo]/pull/[pull]/review-[review]/slides.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,42 @@ | ||
<template> | ||
<div> | ||
<TopBar> | ||
{{ $route.params.org }}/{{ $route.params.repo }}/pull/{{ $route.params.pull }}/review-{{ $route.params.review }} | ||
</TopBar> | ||
<div class="relative h-[96vh]"> | ||
<div v-if="pending"> | ||
<div class="flex flex-col items-stretch"> | ||
<div class="animate-pulse mx-auto text-center text-4xl pt-10 font-bold "> | ||
<GradientText>Loading...</GradientText> | ||
</div> | ||
</div> | ||
</div> | ||
<div v-else-if="error"> | ||
<div class="mx-auto max-w-3xl py-10"> | ||
<div class="bg-orange-100 px-2 pb-2"> | ||
<div class="text-xs text-center underline py-4"> | ||
{{ error }} | ||
</div> | ||
<div class="bg-white p-4 text-center border border-orange-200 rounded"> | ||
<code>{{ error.data }}</code> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div v-else class="absolute top-0 left-0 right-0 bottom-0"> | ||
<SlideShow :model="data" /> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
const route = useRoute(); | ||
const { pending, data, error } = await useFetch('/api/review', { | ||
lazy: true, | ||
params: route.params, | ||
server: false, | ||
initialCache: false, | ||
transform: v => JSON.parse(v), | ||
}); | ||
</script> |
Oops, something went wrong.