|
18 | 18 | </div> |
19 | 19 | <div |
20 | 20 | class="text-right" |
21 | | - :style="TabService.isCurrentTab(props.tab) ? 'border-right:3px solid #1565C0;border-radius:3px' : ''"> |
| 21 | + :style=" |
| 22 | + TabService.isCurrentTab(props.tab) |
| 23 | + ? 'border-right:3px solid #1565C0;border-radius:3px' |
| 24 | + : 'border-right:3px solid #F5F5F5;border-radius:3px' |
| 25 | + "> |
22 | 26 | <slot name="actionPart"> |
23 | 27 | <q-icon |
24 | 28 | v-if="(props.tab as Tab).placeholders" |
|
40 | 44 | <q-tooltip class="tooltip-small">Click here to open in Reading Mode</q-tooltip> |
41 | 45 | </q-icon> |
42 | 46 |
|
43 | | - <q-icon |
| 47 | + <q-btn |
44 | 48 | v-if="(props.tab as Tab).comments && (props.tab as Tab).comments.length > 0" |
45 | | - name="o_chat" |
46 | | - size="16px" |
47 | | - color="primary" |
48 | | - style="position: relative; top: 1px" |
49 | | - class="q-ma-none q-pa-none q-ml-xs" |
| 49 | + icon="o_chat" |
| 50 | + flat |
| 51 | + size="12px" |
| 52 | + style="position: relative; top: 4px" |
| 53 | + class="q-ma-none q-pa-none q-mx-xs" |
50 | 54 | @click.stop="toggleShowWith('comments')"> |
| 55 | + <q-badge floating color="warning" text-color="primary">{{ newCommentsCount() }}</q-badge> |
51 | 56 | <q-tooltip class="tooltip-small">There are comments for this tab</q-tooltip> |
52 | | - </q-icon> |
| 57 | + </q-btn> |
53 | 58 |
|
54 | 59 | <q-icon |
55 | 60 | v-if="props.tab.reminder" |
|
161 | 166 | style="border: 0 solid brown"> |
162 | 167 | <div class="col-1 q-ml-sm q-mt-xs"></div> |
163 | 168 | <div class="col"> |
164 | | - <div |
165 | | - v-if="showCommentList" |
166 | | - v-for="c in props.tab.comments.sort((a: TabComment, b: TabComment) => b.date - a.date)" |
167 | | - class="row q-mr-md q-mt-sm q-pa-sm" |
168 | | - style="border: 1px solid #efefef; border-radius: 3px"> |
169 | | - <div class="col-10 text-body2" @click.stop="editComment(c)"> |
170 | | - {{ c.comment }} |
| 169 | + <template v-if="showCommentList"> |
| 170 | + <div |
| 171 | + v-if="showCommentList" |
| 172 | + v-for="c in props.tab.comments.sort((a: TabComment, b: TabComment) => a.date - b.date)" |
| 173 | + class="row q-mr-md q-mt-sm q-pa-sm" |
| 174 | + :style=" |
| 175 | + c.date > commentsUpdateThreshold |
| 176 | + ? 'border: 1px solid blue; border-radius: 3px' |
| 177 | + : 'border: 1px solid #efefef; border-radius: 3px' |
| 178 | + "> |
| 179 | + <div class="col-10 text-body2" @click.stop="editComment(c)">{{ c.comment }}</div> |
| 180 | + <div class="col text-right"> |
| 181 | + <q-icon size="14px" color="primary" name="sym_o_delete" @click.stop="deleteComment(c)" /> |
| 182 | + </div> |
| 183 | + <div class="col-12 text-right text-caption q-mt-xs">{{ formatDate(c.date) }}</div> |
171 | 184 | </div> |
172 | | - <div class="col text-right"> |
173 | | - <q-icon size="14px" color="primary" name="sym_o_delete" @click.stop="deleteComment(c)" /> |
| 185 | + <div class="row"> |
| 186 | + <div class="col-10 q-mx-sm"> |
| 187 | + <q-input type="text" filled dense autogrow v-model="newComment" /> |
| 188 | + </div> |
| 189 | + <div class="col q-pr-sm" style="border: 0 solid green; display: flex"> |
| 190 | + <q-icon |
| 191 | + name="send" |
| 192 | + @click="addComment()" |
| 193 | + color="warning" |
| 194 | + style="align-self: center; margin-left: auto" |
| 195 | + :disable="!newComment" /> |
| 196 | + </div> |
174 | 197 | </div> |
175 | | - <div class="col-12 text-right text-caption q-mt-xs">{{ formatDate(c.date) }}</div> |
176 | | - </div> |
| 198 | + </template> |
177 | 199 | <div |
178 | 200 | v-else-if="props.tab.comments.length > 0" |
179 | 201 | class="q-ml-sm text-caption" |
@@ -399,6 +421,7 @@ import { RestTab } from 'src/rest/models/RestTab' |
399 | 421 | import TabService from 'src/services/TabService' |
400 | 422 | import { Suggestion } from 'src/suggestions/domain/models/Suggestion' |
401 | 423 | import { useSuggestionsStore } from 'src/suggestions/stores/suggestionsStore' |
| 424 | +import { AddCommentCommand } from 'src/tabsets/commands/AddCommentCommand' |
402 | 425 | import { CreateFolderCommand } from 'src/tabsets/commands/CreateFolderCommand' |
403 | 426 | import { DeleteCommentCommand } from 'src/tabsets/commands/DeleteCommentCommand' |
404 | 427 | import { OpenTabCommand } from 'src/tabsets/commands/OpenTabCommand' |
@@ -435,14 +458,17 @@ const suggestion = ref<Suggestion | undefined>(undefined) |
435 | 458 | const doShowDetails = ref(false) |
436 | 459 | const showCommentList = ref(false) |
437 | 460 | const showRssFeedList = ref(false) |
| 461 | +const commentsUpdateThreshold = ref(0) |
438 | 462 | const showPlaceholderList = ref(false) |
439 | 463 | const opensearchterm = ref<string | undefined>(undefined) |
440 | 464 | const monitor = ref<MonitoredTab | undefined>(undefined) |
441 | 465 | const rssTabReferences = ref<TabReference[]>( |
442 | 466 | props.tab.tabReferences?.filter((r: TabReference) => r.type === TabReferenceType.RSS && r.status !== 'IGNORED'), |
443 | 467 | ) |
| 468 | +const newComment = ref<string | undefined>(undefined) |
444 | 469 |
|
445 | 470 | onMounted(() => { |
| 471 | + commentsUpdateThreshold.value = props.tab.commentsLastUpdated || 0 |
446 | 472 | // if (props.tabset?.id) { |
447 | 473 | // newCommentIds.value = useEventsServices().listNewComments(props.tabset.id, props.tab) |
448 | 474 | // } |
@@ -477,6 +503,10 @@ const toggleLists = (ident: string) => { |
477 | 503 | case 'comments': |
478 | 504 | showCommentList.value = !showCommentList.value |
479 | 505 | console.log('showCommentList set to', showCommentList.value) |
| 506 | + if (showCommentList.value && props.tab) { |
| 507 | + props.tab.commentsLastUpdated = new Date().getTime() |
| 508 | + console.log('***', props.tab.commentsLastUpdated) |
| 509 | + } |
480 | 510 | break |
481 | 511 | case 'placeholder': |
482 | 512 | showPlaceholderList.value = !showPlaceholderList.value |
@@ -647,6 +677,15 @@ const callRestApi = (tab: Tab) => { |
647 | 677 | console.log(`about to call ${restTab.api} with ${JSON.stringify(restTab.params)}`) |
648 | 678 | useNavigationService().browserTabFor(chrome.runtime.getURL('www/index.html/#/mainpanel/restapi/' + restTab.id)) |
649 | 679 | } |
| 680 | +
|
| 681 | +const addComment = () => { |
| 682 | + if (newComment.value) { |
| 683 | + useCommandExecutor().executeFromUi(new AddCommentCommand(props.tab.id, newComment.value)) |
| 684 | + } |
| 685 | +} |
| 686 | +
|
| 687 | +const newCommentsCount = () => |
| 688 | + props.tab.comments.filter((c: TabComment) => c.date > commentsUpdateThreshold.value).length |
650 | 689 | </script> |
651 | 690 |
|
652 | 691 | <style lang="scss" src="src/tabsets/widgets/css/panelTabListElementWidget.scss" /> |
0 commit comments