@rkosafo/cai.components 0.0.71 → 0.0.72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -42,7 +42,7 @@
42
42
  toggleArchieve = async (id: string | number) => {
43
43
  return { success: false, data: null, error: null } as any;
44
44
  },
45
- toggleAsRead = async (id: string | number) => {
45
+ toggleAsRead = async (id: string | number, type?: MailMarkReadToggleType) => {
46
46
  return { success: false, data: null, error: null } as any;
47
47
  },
48
48
  toggleFavourite = async (id: string | number) => {
@@ -197,7 +197,7 @@
197
197
  const results = [];
198
198
 
199
199
  for (const msg of selectedMessages) {
200
- const res = await toggleAsRead(msg);
200
+ const res = await toggleAsRead(msg, val);
201
201
  results.push(res);
202
202
  }
203
203
  selectedMessages = [];
@@ -325,6 +325,19 @@
325
325
  pageInfo.setPageSize(1);
326
326
  }
327
327
 
328
+ async function getIsRead(id: number): Promise<boolean> {
329
+ let status = false;
330
+ try {
331
+ const ret = await readAMessage(id);
332
+ if (!ret?.success) {
333
+ return false;
334
+ }
335
+ status = ret.data?.isRead || false;
336
+ return status;
337
+ } catch (error) {}
338
+ return status;
339
+ }
340
+
328
341
  $effect(() => {
329
342
  fetchData(pageNumber, { search: query }, activeBox);
330
343
  });
@@ -333,15 +346,13 @@
333
346
  <div class="h-full w-full">
334
347
  <div class="flex h-full w-full gap-2">
335
348
  <div class:hidden={!showSidePanel} class="loginbox h-full w-20 rounded-md bg-white">
336
- <MailSidebar onClick={toggleSideBar} menus={menutItems} {setActiveMenu}
337
-
338
- />
349
+ <MailSidebar onClick={toggleSideBar} menus={menutItems} {setActiveMenu} />
339
350
  </div>
340
351
  <div class="flex w-full flex-grow flex-col gap-1">
341
352
  <div class="loginbox h-14 rounded bg-white px-4">
342
353
  <MailToolBar
343
354
  isFavoriteActive={false}
344
- isReadActive={false}
355
+ isReadActive={async () => await getIsRead(messageSelected)}
345
356
  showBackButton={Boolean(messageSelected)}
346
357
  {showPagination}
347
358
  {showComposeButton}
@@ -67,7 +67,7 @@ export interface MailingModuleProps {
67
67
  toggleArchieve?: (id: string | number) => Promise<CrudResult<any>> | CrudResult<any> | null;
68
68
  toggleSpam?: (id: string | number) => Promise<CrudResult<any>> | CrudResult<any> | null;
69
69
  deleteEntry?: (id: string | number) => Promise<CrudResult<any>> | CrudResult<any> | null;
70
- toggleAsRead?: (id: string | number) => Promise<CrudResult<any>> | CrudResult<any> | null;
70
+ toggleAsRead?: (id: string | number, type?: MailMarkReadToggleType) => Promise<CrudResult<any>> | CrudResult<any> | null;
71
71
  toggleFavourite?: (id: string | number) => Promise<CrudResult<any>> | CrudResult<any> | null;
72
72
  toggelImportant?: (id: string | number) => Promise<CrudResult<any>> | CrudResult<any> | null;
73
73
  readAMessage: (id: string | number) => Promise<CrudResult<any>> | CrudResult<any> | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rkosafo/cai.components",
3
- "version": "0.0.71",
3
+ "version": "0.0.72",
4
4
  "files": [
5
5
  "dist",
6
6
  "!dist/**/*.test.*",