pukaad-ui-lib 1.385.0 → 1.386.0

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.
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
3
  "configKey": "pukaadUI",
4
- "version": "1.385.0",
4
+ "version": "1.386.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -2,6 +2,7 @@ import type { CardContentMenuState } from "#pukaad-ui/types/components/card/card
2
2
  type __VLS_Props = {
3
3
  state?: CardContentMenuState;
4
4
  isPinned?: boolean;
5
+ isLiked?: boolean;
5
6
  isBookmarked?: boolean;
6
7
  isShow?: boolean;
7
8
  };
@@ -11,6 +12,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
11
12
  onAction?: ((name: string) => any) | undefined;
12
13
  }>, {
13
14
  isPinned: boolean;
15
+ isLiked: boolean;
14
16
  isBookmarked: boolean;
15
17
  isShow: boolean;
16
18
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -19,6 +19,7 @@ import { computed } from "vue";
19
19
  const props = defineProps({
20
20
  state: { type: String, required: false },
21
21
  isPinned: { type: Boolean, required: false, default: false },
22
+ isLiked: { type: Boolean, required: false, default: false },
22
23
  isBookmarked: { type: Boolean, required: false, default: false },
23
24
  isShow: { type: Boolean, required: false, default: false }
24
25
  });
@@ -38,6 +39,7 @@ const actions = computed(() => {
38
39
  }
39
40
  if (props.state === "content") {
40
41
  return [
42
+ { name: "like", icon: "lucide:heart", isActive: props.isLiked },
41
43
  { name: "bookmark", icon: "lucide:bookmark", isActive: props.isBookmarked },
42
44
  { name: "preview", icon: "lucide:tv-minimal-play" }
43
45
  ];
@@ -2,6 +2,7 @@ import type { CardContentMenuState } from "#pukaad-ui/types/components/card/card
2
2
  type __VLS_Props = {
3
3
  state?: CardContentMenuState;
4
4
  isPinned?: boolean;
5
+ isLiked?: boolean;
5
6
  isBookmarked?: boolean;
6
7
  isShow?: boolean;
7
8
  };
@@ -11,6 +12,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
11
12
  onAction?: ((name: string) => any) | undefined;
12
13
  }>, {
13
14
  isPinned: boolean;
15
+ isLiked: boolean;
14
16
  isBookmarked: boolean;
15
17
  isShow: boolean;
16
18
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -24,6 +24,7 @@
24
24
  <CardContentMenu
25
25
  :state="props.state"
26
26
  :is-pinned="!!props.item.pinned"
27
+ :is-liked="!!props.item.liked"
27
28
  :is-bookmarked="!!props.item.bookmarked"
28
29
  :is-show="hovering"
29
30
  @action="onMenuAction"
@@ -96,7 +96,7 @@ const reactions = [
96
96
  {
97
97
  name: "bookmarked",
98
98
  icon: "lucide:bookmark",
99
- iconReacted: "fa6-solid:bookmark",
99
+ iconReacted: "pukaad:bookmark-solid",
100
100
  action: toggleBookmark
101
101
  },
102
102
  {
@@ -128,11 +128,33 @@ async function toggleLike() {
128
128
  reaction.liked = previousLiked;
129
129
  counts.liked += previousLiked ? 1 : -1;
130
130
  }
131
+ } else if (props.state === "content" && props.id) {
132
+ try {
133
+ await api(`/contents/${props.id}/like`, {
134
+ method: reaction.liked ? "POST" : "DELETE"
135
+ });
136
+ } catch (error) {
137
+ console.error(error);
138
+ reaction.liked = previousLiked;
139
+ counts.liked += previousLiked ? 1 : -1;
140
+ }
131
141
  }
132
142
  }
133
- function toggleBookmark() {
134
- reaction.bookmarked = !reaction.bookmarked;
143
+ async function toggleBookmark() {
144
+ const previousBookmarked = reaction.bookmarked;
145
+ reaction.bookmarked = !previousBookmarked;
135
146
  counts.bookmarked += reaction.bookmarked ? 1 : -1;
147
+ if (props.state === "content" && props.id) {
148
+ try {
149
+ await api(`/contents/${props.id}/bookmark`, {
150
+ method: reaction.bookmarked ? "POST" : "DELETE"
151
+ });
152
+ } catch (error) {
153
+ console.error(error);
154
+ reaction.bookmarked = previousBookmarked;
155
+ counts.bookmarked += previousBookmarked ? 1 : -1;
156
+ }
157
+ }
136
158
  }
137
159
  function toggleComment() {
138
160
  console.log("comment ");
@@ -49,9 +49,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
49
49
  name: string;
50
50
  required: boolean;
51
51
  description: string;
52
+ options: AutocompleteOption[] | string[] | number[];
52
53
  labelKey: string;
53
54
  placeholder: string;
54
- options: AutocompleteOption[] | string[] | number[];
55
55
  limit: number;
56
56
  disabledErrorMessage: boolean;
57
57
  disabledBorder: boolean;
@@ -49,9 +49,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
49
49
  name: string;
50
50
  required: boolean;
51
51
  description: string;
52
+ options: AutocompleteOption[] | string[] | number[];
52
53
  labelKey: string;
53
54
  placeholder: string;
54
- options: AutocompleteOption[] | string[] | number[];
55
55
  limit: number;
56
56
  disabledErrorMessage: boolean;
57
57
  disabledBorder: boolean;
@@ -11,8 +11,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
11
11
  label: string;
12
12
  name: string;
13
13
  modelValue: LocalizedNameItem[];
14
- placeholder: string;
15
14
  options: InputSelectItem[];
15
+ placeholder: string;
16
16
  limit: number;
17
17
  showCounter: boolean;
18
18
  addLabel: string;
@@ -11,8 +11,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
11
11
  label: string;
12
12
  name: string;
13
13
  modelValue: LocalizedNameItem[];
14
- placeholder: string;
15
14
  options: InputSelectItem[];
15
+ placeholder: string;
16
16
  limit: number;
17
17
  showCounter: boolean;
18
18
  addLabel: string;
@@ -25,8 +25,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
25
25
  "onUpdate:modelValue"?: ((value: SelectedTag[]) => any) | undefined;
26
26
  }>, {
27
27
  name: string;
28
- placeholder: string;
29
28
  state: "user" | "admin";
29
+ placeholder: string;
30
30
  limit: number;
31
31
  ignore: string[];
32
32
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -25,8 +25,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
25
25
  "onUpdate:modelValue"?: ((value: SelectedTag[]) => any) | undefined;
26
26
  }>, {
27
27
  name: string;
28
- placeholder: string;
29
28
  state: "user" | "admin";
29
+ placeholder: string;
30
30
  limit: number;
31
31
  ignore: string[];
32
32
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -21,6 +21,7 @@ export interface RawContentCard {
21
21
  }[];
22
22
  is_pinned?: boolean;
23
23
  is_liked?: boolean;
24
+ is_bookmarked?: boolean;
24
25
  expire_at?: string;
25
26
  }
26
27
  export interface MapContentToCardOptions {
@@ -15,7 +15,8 @@ export const mapContentToCard = (raw, options = {}) => {
15
15
  type,
16
16
  location: place?.name || place?.address,
17
17
  pinned: !!raw.is_pinned,
18
- bookmarked: !!raw.is_liked,
18
+ liked: !!raw.is_liked,
19
+ bookmarked: !!raw.is_bookmarked,
19
20
  expireAt: options.showExpiry ? raw.expire_at : void 0
20
21
  };
21
22
  if (type === "postIt") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
- "version": "1.385.0",
3
+ "version": "1.386.0",
4
4
  "description": "pukaad-ui for MeMSG",
5
5
  "repository": {
6
6
  "type": "git",