-
Notifications
You must be signed in to change notification settings - Fork 17
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
321 additions
and
14 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
30 changes: 30 additions & 0 deletions
30
src/components/Document/DocumentUserActions/DocumentUserComments/DocumentUserComments.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,30 @@ | ||
<script setup> | ||
import DocumentUserCommentsList from '@/components/Document/DocumentUserActions/DocumentUserComments/DocumentUserCommentsList' | ||
import DocumentUserCommentsAction from '@/components/Document/DocumentUserActions/DocumentUserComments/DocumentUserCommentsAction' | ||
import DocumentUserActionsCard from '@/components/Document/DocumentUserActions/DocumentUserActionsCard.vue' | ||
const comment = defineModel({ | ||
type: String, | ||
required: true | ||
}) | ||
const props = defineProps({ | ||
comments: { type: Array, default: () => [] } | ||
}) | ||
const title = `${props.comments.length} comments` | ||
</script> | ||
|
||
<template> | ||
<document-user-actions-card icon="chats-teardrop" :title="title" :show-warning="true"> | ||
<template #content> | ||
<document-user-comments-list :comments="comments" /> | ||
</template> | ||
<template #footer-warning | ||
>Your comments are public to project’s members and are also be visible on the iHub | ||
</template> | ||
<template #footer> | ||
<document-user-comments-action :model-value="comment" @update:model-value="$emit('update:modelValue', $event)" /> | ||
</template> | ||
</document-user-actions-card> | ||
</template> | ||
|
||
<style scoped lang="scss"></style> |
14 changes: 14 additions & 0 deletions
14
...mponents/Document/DocumentUserActions/DocumentUserComments/DocumentUserCommentsAction.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,14 @@ | ||
<script setup> | ||
const comment = defineModel({ | ||
type: String, | ||
required: true | ||
}) | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<b-form-textarea v-model="comment" placeholder="Write your text"></b-form-textarea> | ||
</div> | ||
</template> | ||
|
||
<style scoped lang="scss"></style> |
78 changes: 78 additions & 0 deletions
78
...components/Document/DocumentUserActions/DocumentUserComments/DocumentUserCommentsList.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,78 @@ | ||
<script setup> | ||
import { PhosphorIcon } from '@icij/murmur-next' | ||
import { computed } from 'vue' | ||
import DocumentUserCommentsListEntry from '@/components/Document/DocumentUserActions/DocumentUserComments/DocumentUserCommentsListEntry.vue' | ||
defineOptions({ name: 'DocumentUserCommentsList' }) | ||
const open = defineModel('open', { | ||
type: Boolean, | ||
default: true | ||
}) | ||
const props = defineProps({ | ||
comments: { type: Array, default: () => [] }, | ||
height: { type: String, default: '250px' } | ||
}) | ||
const style = { | ||
'--document-user-comments-list__comments__list--height': props.height | ||
} | ||
const firstComment = '#comment-0' | ||
const lastComment = props.comments.length ? `#comment-${props.comments.length - 1}` : '' | ||
const closedEye = computed(() => { | ||
return open.value ? 'regular' : 'fill' | ||
}) | ||
const sortingText = 'From oldest to most recent' | ||
const displayComments = computed(() => (open.value ? 'Hide comments' : 'Show comments')) | ||
const goToOldest = 'Go to oldest' | ||
const goToRecent = 'Go to most recent' | ||
const noComments = 'No comments on this document yet.' | ||
</script> | ||
|
||
<template> | ||
<section class="document-user-comments-list"> | ||
<header class="d-flex justify-content-between align-items-center"> | ||
<span><phosphor-icon name="sortAscending" />{{ sortingText }}</span> | ||
<span | ||
class="btn btn-outline-link d-inline-flex justify-content-between" | ||
style="width: 190px" | ||
@click="open = !open" | ||
><phosphor-icon name="eyeClosed" :weight="closedEye" class="me-2" />{{ displayComments }}</span | ||
> | ||
</header> | ||
<section v-if="open" class="document-user-comments-list__comments py-2"> | ||
<template v-if="comments.length"> | ||
<header class="text-center py-2"> | ||
<a :href="firstComment">{{ goToOldest }}</a> | ||
</header> | ||
<article class="document-user-comments-list__comments__list d-block overflow-y-scroll" :style="style"> | ||
<document-user-comments-list-entry | ||
v-for="(comment, index) in comments" | ||
:id="`comment-${index}`" | ||
:key="index" | ||
:text="comment.text" | ||
:to="comment.to" | ||
:date="comment.date" | ||
:username="comment.username" | ||
/> | ||
</article> | ||
<footer class="text-center py-2"> | ||
<a :href="lastComment">{{ goToRecent }}</a> | ||
</footer> | ||
</template> | ||
<template v-else> | ||
<div class="text-center py-2">{{ noComments }}</div> | ||
</template> | ||
</section> | ||
</section> | ||
</template> | ||
|
||
<style scoped lang="scss"> | ||
.document-user-comments-list { | ||
&__comments__list { | ||
height: var(--document-user-comments-list__comments__list--height); | ||
} | ||
} | ||
</style> |
28 changes: 28 additions & 0 deletions
28
...nents/Document/DocumentUserActions/DocumentUserComments/DocumentUserCommentsListEntry.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,28 @@ | ||
<script setup> | ||
import DisplayUser from '@/components/Display/DisplayUser.vue' | ||
import DisplayDatetime from '@/components/Display/DisplayDatetime.vue' | ||
import ButtonIcon from '@/components/Button/ButtonIcon.vue' | ||
defineProps({ | ||
username: { type: String, required: true }, | ||
date: { type: Number, required: true }, | ||
to: { type: String, required: true }, | ||
text: { type: String, required: true } | ||
}) | ||
const goToComment = 'Go to comment' | ||
</script> | ||
|
||
<template> | ||
<section class="py-2"> | ||
<div class="d-flex"> | ||
<display-user :username="username" /> | ||
<display-datetime class="ms-auto" :value="date" /> | ||
<button-icon variant="link" icon-left="arrowSquareOut" square hide-label :label="goToComment" /> | ||
<!-- <button-icon variant="link" icon-left="arrowSquareOut" square hide-label label="Link to comment" :to="to" />--> | ||
</div> | ||
<article class="ps-4 text-justify">{{ text }}</article> | ||
</section> | ||
</template> | ||
|
||
<style scoped lang="scss"></style> |
63 changes: 63 additions & 0 deletions
63
...ponents/Document/DocumentUserActions/DocumentUserComments/DocumentUserComments.stories.js
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,63 @@ | ||
import DocumentUserComments from '@/components/Document/DocumentUserActions/DocumentUserComments/DocumentUserComments' | ||
import { storeDecoratorPipelineChainByCategory } from '~storybook/decorators/vuex' | ||
|
||
export default { | ||
title: 'Components/Document/DocumentUserActions/DocumentUserComments/DocumentUserComments', | ||
tags: ['autodocs'], | ||
decorators: [storeDecoratorPipelineChainByCategory], | ||
component: DocumentUserComments, | ||
args: { | ||
comments: [], | ||
modelValue: null | ||
} | ||
} | ||
export const Default = {} | ||
|
||
export const WithComments = { | ||
args: { | ||
comments: [ | ||
{ | ||
username: 'bfett', | ||
date: Date.now() - 150000000000, | ||
to: 'http://example.com', | ||
text: 'I would like to underline the role of the Galactic empress in creating the company as you can see here on this document page 65, paragraph 3. She says “I created the company in 2016 [...]”. This is very important to mention in the article that we plan to publish with the Guardian. cc @chorizo @tomatoe' | ||
}, | ||
{ | ||
username: 'lskywalker', | ||
date: Date.now() - 100000000000, | ||
to: 'http://example.com', | ||
text: "I'm not sure this is enough for the Vulkans to write the story. Wdyt @spoke?" | ||
}, | ||
{ | ||
username: 'spoke', | ||
date: Date.now(), | ||
to: 'http://example.com', | ||
text: 'May the force be with you 🖖' | ||
}, | ||
{ | ||
username: 'bfett', | ||
date: Date.now() - 50000000000, | ||
to: 'http://example.com', | ||
text: 'Did you have any info on the stargate ?' | ||
}, | ||
{ | ||
username: 'ttilk', | ||
date: Date.now() - 100000000000, | ||
to: 'http://example.com', | ||
text: 'This is a top secret information not sur tha @yoda would approve' | ||
}, | ||
{ | ||
username: 'byoda', | ||
date: Date.now(), | ||
to: 'http://example.com', | ||
text: 'The document number 101010001 you may read.' | ||
}, | ||
{ | ||
username: 'r2d2', | ||
date: Date.now(), | ||
to: 'http://example.com', | ||
text: 'BLIP!' | ||
} | ||
] | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...s/Document/DocumentUserActions/DocumentUserComments/DocumentUserCommentsAction.stories.js
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,11 @@ | ||
import DocumentUserCommentsAction from '@/components/Document/DocumentUserActions/DocumentUserComments/DocumentUserCommentsAction' | ||
|
||
export default { | ||
title: 'Components/Document/DocumentUserActions/DocumentUserComments/DocumentUserCommentsAction', | ||
tags: ['autodocs'], | ||
component: DocumentUserCommentsAction, | ||
args: { | ||
comment: 'cdesprat' | ||
} | ||
} | ||
export const Default = {} |
61 changes: 61 additions & 0 deletions
61
...nts/Document/DocumentUserActions/DocumentUserComments/DocumentUserCommentsList.stories.js
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,61 @@ | ||
import DocumentUserCommentsList from '@/components/Document/DocumentUserActions/DocumentUserComments/DocumentUserCommentsList' | ||
import { storeDecoratorPipelineChainByCategory } from '~storybook/decorators/vuex' | ||
|
||
export default { | ||
title: 'Components/Document/DocumentUserActions/DocumentUserComments/DocumentUserCommentsList', | ||
tags: ['autodocs'], | ||
component: DocumentUserCommentsList, | ||
decorators: [storeDecoratorPipelineChainByCategory], | ||
args: { | ||
comments: [] | ||
} | ||
} | ||
export const Default = {} | ||
export const WithComments = { | ||
args: { | ||
comments: [ | ||
{ | ||
username: 'bfett', | ||
date: Date.now() - 150000000000, | ||
to: 'http://example.com', | ||
text: 'I would like to underline the role of the Galactic empress in creating the company as you can see here on this document page 65, paragraph 3. She says “I created the company in 2016 [...]”. This is very important to mention in the article that we plan to publish with the Guardian. cc @chorizo @tomatoe' | ||
}, | ||
{ | ||
username: 'lskywalker', | ||
date: Date.now() - 100000000000, | ||
to: 'http://example.com', | ||
text: "I'm not sure this is enough for the Vulkans to write the story. Wdyt @spoke?" | ||
}, | ||
{ | ||
username: 'spoke', | ||
date: Date.now(), | ||
to: 'http://example.com', | ||
text: 'May the force be with you 🖖' | ||
}, | ||
{ | ||
username: 'bfett', | ||
date: Date.now() - 50000000000, | ||
to: 'http://example.com', | ||
text: 'Did you have any info on the stargate ?' | ||
}, | ||
{ | ||
username: 'ttilk', | ||
date: Date.now() - 100000000000, | ||
to: 'http://example.com', | ||
text: 'This is a top secret information not sur tha @yoda would approve' | ||
}, | ||
{ | ||
username: 'byoda', | ||
date: Date.now(), | ||
to: 'http://example.com', | ||
text: 'The document number 101010001 you may read.' | ||
}, | ||
{ | ||
username: 'r2d2', | ||
date: Date.now(), | ||
to: 'http://example.com', | ||
text: 'BLIP!' | ||
} | ||
] | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...ocument/DocumentUserActions/DocumentUserComments/DocumentUserCommentsListEntry.stories.js
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,16 @@ | ||
import DocumentUserCommentsListEntry from '@/components/Document/DocumentUserActions/DocumentUserComments/DocumentUserCommentsListEntry' | ||
import { storeDecoratorPipelineChainByCategory } from '~storybook/decorators/vuex' | ||
|
||
export default { | ||
title: 'Components/Document/DocumentUserActions/DocumentUserComments/DocumentUserCommentsListEntry', | ||
decorators: [storeDecoratorPipelineChainByCategory], | ||
tags: ['autodocs'], | ||
component: DocumentUserCommentsListEntry, | ||
args: { | ||
username: 'bfett', | ||
date: Date.now(), | ||
to: 'http://example.com', | ||
text: 'I would like to underline the role of the Galactic empress in creating the company as you can see here on this document page 65, paragraph 3. She says “I created the company in 2016 [...]”. This is very important to mention in the article that we plan to publish with the Guardian. cc @chorizo @tomatoe' | ||
} | ||
} | ||
export const Default = {} |