Skip to content

Commit 93921dc

Browse files
refactor: merge PaperResearchContextCard and PaperReviewCard
They only differ in some minor conditions, so we can easily merge them and put the conditions inside.
1 parent 744c9b9 commit 93921dc

File tree

3 files changed

+55
-65
lines changed

3 files changed

+55
-65
lines changed

src/lib/components/composites/paper-components/paper-view/PaperView.svelte

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import PaperDetailsCard from "$lib/components/composites/paper-components/paper-view/cards/PaperDetailsCard.svelte";
44
import PaperResearchContextCard from "$lib/components/composites/paper-components/paper-view/cards/PaperResearchContextCard.svelte";
55
import PaperBookmarkButton from "../../PaperBookmarkButton.svelte";
6-
import PaperReviewCard from "./cards/PaperReviewCard.svelte";
76
import AcceptButton from "./decision-buttons/AcceptButton.svelte";
87
import DeclineButton from "./decision-buttons/DeclineButton.svelte";
98
import MaybeButton from "./decision-buttons/MaybeButton.svelte";
@@ -84,11 +83,11 @@ Usage:
8483
<main class="flex flex-col h-full w-full px-2 py-4 gap-5">
8584
<div class="flex flex-row w-full h-full gap-5">
8685
<PaperDetailsCard {loadingPaper} {allowEditModeToggle} {startInEditMode} />
87-
{#if userConfig.isReviewMode}
88-
<PaperReviewCard {backwardReferencedPapers} {forwardReferencedPapers} />
89-
{:else}
90-
<PaperResearchContextCard {backwardReferencedPapers} {forwardReferencedPapers} />
91-
{/if}
86+
<PaperResearchContextCard
87+
inReviewMode={userConfig.isReviewMode}
88+
{backwardReferencedPapers}
89+
{forwardReferencedPapers}
90+
/>
9291
</div>
9392
{#if showButtonBar}
9493
<div class="flex flex-row w-full h-fit justify-between gap-4" data-testid="button-bar">

src/lib/components/composites/paper-components/paper-view/cards/PaperResearchContextCard.svelte

Lines changed: 50 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,69 @@
55
type ReferencesAndCitationsCardContentProps,
66
} from "./ReferencesAndCitationsCardContent.svelte";
77
8-
let {
9-
backwardReferencedPapers,
10-
forwardReferencedPapers,
11-
}: ReferencesAndCitationsCardContentProps = $props();
8+
type Props = {
9+
inReviewMode: boolean;
10+
} & ReferencesAndCitationsCardContentProps;
1211
13-
const tabs = [
14-
{ value: "1", label: "Forward/Backward References" },
15-
{ value: "2", label: "Review Information" },
16-
];
12+
let { inReviewMode, backwardReferencedPapers, forwardReferencedPapers }: Props = $props();
13+
14+
const tabs = inReviewMode
15+
? [
16+
{ value: "1", label: "Review Information" },
17+
{ value: "2", label: "Forward/Backward References" },
18+
]
19+
: [
20+
{ value: "1", label: "Forward/Backward References" },
21+
{ value: "2", label: "Review Information" },
22+
];
1723
</script>
1824

1925
<!--
2026
@component
21-
Paper Card for paper research context in the Paper View component.
27+
Paper Card for review information of a paper in the Paper View component.
2228
2329
Usage:
2430
```svelte
25-
<PaperResearchContextCard {backwardReferencedPapers} {forwardReferencedPapers} />
31+
<PaperResearchContextCard {inReviewMode} {backwardReferencedPapers} {forwardReferencedPapers} />
2632
```
2733
-->
2834
<PaperCard {tabs}>
2935
<PaperCardContent value="1">
30-
<ReferencesAndCitationsCardContent {backwardReferencedPapers} {forwardReferencedPapers} />
36+
{#if inReviewMode}
37+
<span>
38+
Will be implemented in
39+
<a
40+
class="text-blue-400"
41+
href="https://github.com/SE-UUlm/snowballr-frontend/issues/53"
42+
>
43+
#53
44+
</a>
45+
.
46+
</span>
47+
{:else}
48+
<ReferencesAndCitationsCardContent
49+
{backwardReferencedPapers}
50+
{forwardReferencedPapers}
51+
/>
52+
{/if}
3153
</PaperCardContent>
3254
<PaperCardContent value="2">
33-
<span>
34-
Will be implemented in
35-
<a class="text-blue-400" href="https://github.com/SE-UUlm/snowballr-frontend/issues/45">
36-
#45
37-
</a>
38-
.
39-
</span>
55+
{#if inReviewMode}
56+
<ReferencesAndCitationsCardContent
57+
{backwardReferencedPapers}
58+
{forwardReferencedPapers}
59+
/>
60+
{:else}
61+
<span>
62+
Will be implemented in
63+
<a
64+
class="text-blue-400"
65+
href="https://github.com/SE-UUlm/snowballr-frontend/issues/45"
66+
>
67+
#45
68+
</a>
69+
.
70+
</span>
71+
{/if}
4072
</PaperCardContent>
4173
</PaperCard>

src/lib/components/composites/paper-components/paper-view/cards/PaperReviewCard.svelte

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)