-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update bookmarks #343
Open
AyshaHakeem
wants to merge
7
commits into
frappe:main
Choose a base branch
from
AyshaHakeem:fix-bookmarks
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Update bookmarks #343
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
91404be
fix: update GP Bookmark doctype
AyshaHakeem 7182e1f
fix: update associated bookmark functions
AyshaHakeem d068cb3
feat: add DiscussionListByData component
AyshaHakeem f8173e8
fix: only display user's own bookmarks
AyshaHakeem 55f3d74
fix: update bookmarks tab
AyshaHakeem d0cf30a
Merge branch 'main' into fix-bookmarks
AyshaHakeem cd8fe0a
refactor: check status of discussion's bookmark
AyshaHakeem File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
<template> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a duplicate of DiscussionList without the data fetching. The correct way for this refactor is to make DiscussionList use DiscussionListByData. Also, DiscussionList is a better name for a component that only renders UI and data fetching can be done separately. |
||
<div class="h-full"> | ||
<router-link | ||
v-for="(d, index) in discussions" | ||
:key="d.name" | ||
:to="{ | ||
name: 'ProjectDiscussion', | ||
params: { | ||
teamId: d.team, | ||
projectId: d.project, | ||
postId: d.name, | ||
slug: d.slug, | ||
}, | ||
}" | ||
class="group relative block h-15 rounded-[10px] transition hover:bg-gray-100" | ||
> | ||
<div class="flex h-full items-center space-x-4 overflow-hidden px-3 py-2"> | ||
<UserInfo :email="d.last_post_by || d.owner"> | ||
<template v-slot="{ user }"> | ||
<div class="flex items-center space-x-3"> | ||
<div class="relative flex"> | ||
<UserAvatar :user="d.closed_by || user.name" size="2xl" /> | ||
</div> | ||
</div> | ||
<div class="min-w-0 flex-1"> | ||
<div class="flex min-w-0 items-center"> | ||
<div | ||
class="overflow-hidden text-ellipsis whitespace-nowrap leading-none text-gray-900'" | ||
> | ||
<span | ||
class="overflow-hidden text-ellipsis whitespace-nowrap text-base font-medium" | ||
> | ||
{{ d.title }} | ||
</span> | ||
</div> | ||
</div> | ||
<div class="mt-1.5 flex min-w-0 items-center justify-between"> | ||
<div | ||
class="overflow-hidden text-ellipsis whitespace-nowrap text-base text-gray-600" | ||
> | ||
<span> | ||
{{ user.full_name }} | ||
</span> | ||
<template v-if="d.project"> | ||
<span> in </span> | ||
<span> | ||
{{ d.team }} | ||
<span class="text-gray-500"> — </span> | ||
{{ d.project }} | ||
</span> | ||
</template> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="ml-auto"> | ||
<div | ||
class="shrink-0 whitespace-nowrap text-sm text-gray-600" | ||
:title="discussionTimestampDescription(d)" | ||
> | ||
{{ discussionTimestamp(d) }} | ||
</div> | ||
<div class="mt-1.5 flex items-center justify-end space-x-3"> | ||
<Badge>{{ d.comments_count + 1 }}</Badge> | ||
</div> | ||
</div> | ||
</template> | ||
</UserInfo> | ||
</div> | ||
<div | ||
class="mx-3 h-px border-t border-gray-200" | ||
v-if="index < discussions?.length - 1" | ||
></div> | ||
</router-link> | ||
<div class="px-2 sm:px-0"> | ||
<div | ||
v-if="discussions?.length === 0" | ||
class="flex flex-col items-center rounded-lg border-2 border-dashed py-8 text-base text-gray-600" | ||
> | ||
<LucideCoffee class="h-7 w-7 text-gray-500" /> | ||
No discussions | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'DiscussionListByData', | ||
props: { | ||
discussions: { | ||
type: Array, | ||
required: true, | ||
}, | ||
}, | ||
methods: { | ||
discussionTimestamp(discussion) { | ||
let timestamp = discussion.last_post_at || discussion.creation | ||
if (this.$dayjs().diff(timestamp, 'day') < 25) { | ||
return this.$dayjs(timestamp).fromNow() | ||
} | ||
if (this.$dayjs().diff(timestamp, 'year') < 1) { | ||
return this.$dayjs(timestamp).format('D MMM') | ||
} | ||
return this.$dayjs(timestamp).format('D MMM YYYY') | ||
}, | ||
discussionTimestampDescription(discussion) { | ||
return [ | ||
`First Post: ${this.$dayjs(discussion.creation)}`, | ||
`Latest Post: ${this.$dayjs(discussion.last_post_at)}`, | ||
].join('\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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A single line change shouldn't affect other lines in a commit. This messes up git blame. If you want to format the other lines, do it in another commit.