@logora/debate 0.3.54 → 0.3.55

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.
@@ -186,7 +186,7 @@ const it = We(() => import("../../modal/side_modal/index.js").then((I) => ({ def
186
186
  if (t.data.success) {
187
187
  const r = t.data.data.resource;
188
188
  let s = I;
189
- if (r.is_reply ? s = `argument_${r.reply_to_id || W?.reply_to_id}_reply_list` : l && !m && (s = `argumentList${r.position?.id}`), W?.position?.id != r.position?.id && !m && !r.is_reply) {
189
+ if (r.is_reply ? s = `argument_${r.reply_to_id || W?.reply_to_id}_reply_list` : l && !m && (s = `argumentList${r.position?.id}`), console.log("[updateArgument] listId:", s), W?.position?.id != r.position?.id && !m && !r.is_reply) {
190
190
  const y = `argumentList${W.position.id}`, T = `argumentList${r.position.id}`;
191
191
  x.remove(y, [r]), x.add(T, [r]);
192
192
  } else
@@ -1,13 +1,13 @@
1
- import { jsxs as U, jsx as c, Fragment as Le } from "react/jsx-runtime";
2
- import je from "@rooks/use-previous";
3
- import Be from "classnames";
1
+ import { jsxs as P, jsx as c, Fragment as je } from "react/jsx-runtime";
2
+ import Be from "@rooks/use-previous";
3
+ import Le from "classnames";
4
4
  import Qe, { useState as m, useEffect as h } from "react";
5
- import { useIntl as Ue } from "react-intl";
6
- import { useLocation as We } from "react-router";
5
+ import { useIntl as Pe } from "react-intl";
6
+ import { useLocation as Ue } from "react-router";
7
7
  import a from "./PaginatedList.module.scss.js";
8
- import { ActionBar as ze } from "./action_bar/ActionBar.js";
9
- import { useList as Ge } from "../list_provider/useList.js";
10
- import { useDataProvider as Pe } from "../../data/data_provider/useDataProvider.js";
8
+ import { ActionBar as We } from "./action_bar/ActionBar.js";
9
+ import { useList as ze } from "../list_provider/useList.js";
10
+ import { useDataProvider as Ge } from "../../data/data_provider/useDataProvider.js";
11
11
  import { useResponsive as Ve } from "../../hooks/use_responsive/useResponsive.js";
12
12
  import { useData as Xe } from "../../data/data_provider/useData.js";
13
13
  import { uniqueBy as A } from "../../util/unique_by/uniqueBy.js";
@@ -30,16 +30,16 @@ const rt = ({
30
30
  queryParam: me = "query",
31
31
  tagParam: re = "tag_id",
32
32
  totalHeaderParam: D = "total",
33
- onUpdateTotal: W,
33
+ onUpdateTotal: U,
34
34
  onElementsLoad: R,
35
- transformData: z,
35
+ transformData: W,
36
36
  uniqueIdKey: v = "id",
37
37
  children: de,
38
38
  resourcePropName: fe,
39
- loadingComponent: G,
39
+ loadingComponent: z,
40
40
  searchBar: ce = !1,
41
41
  title: ue,
42
- emptyListComponent: P,
42
+ emptyListComponent: G,
43
43
  emptyText: V,
44
44
  display: X,
45
45
  elementsPerLine: Y,
@@ -52,16 +52,16 @@ const rt = ({
52
52
  withUrlParams: Se = !1,
53
53
  onLoadNewPage: $
54
54
  }) => {
55
- const J = Ue(), t = Ge(), H = Pe(), I = We(), { isMobile: K, isTablet: ye, isDesktop: L } = Ve(), [b, u] = m(!1), [we, Ne] = m(!1), [k, S] = Xe(n, []), [O, Me] = m(
55
+ const J = Pe(), t = ze(), H = Ge(), I = Ue(), { isMobile: K, isTablet: ye, isDesktop: j } = Ve(), [b, u] = m(!1), [we, Ne] = m(!1), [k, S] = Xe(n, []), [O, Me] = m(
56
56
  k?.length || 0
57
- ), [E, j] = m(M || 1), [y, B] = m(w || null), [C, q] = m(null), [Re, ee] = m(null), r = new URLSearchParams(
57
+ ), [E, B] = m(M || 1), [y, L] = m(w || null), [C, q] = m(null), [Re, ee] = m(null), r = new URLSearchParams(
58
58
  typeof window < "u" ? window.location.search : I.search
59
59
  ), be = () => i && i[0].type === "sort" && i[0].value || N || "", ke = () => {
60
60
  let e = {};
61
61
  return i && i[0].type === "filter" && (e[i[0].name] = i[0].value), o && (e = Object.assign({}, e, o)), e;
62
- }, [F, T] = m(be()), [Q, x] = m(ke()), te = je(o);
63
- M && M !== E && j(M), w !== void 0 && w !== y && B(w), N !== void 0 && N !== F && T(N), te && JSON.stringify(o) !== JSON.stringify(te) && JSON.stringify(o) !== JSON.stringify(Q) && x(o), h(() => {
64
- if (r.get("tagId") && q(Number.parseInt(r.get("tagId"))), r.get("search") && B(r.get("search")), r.get("sort")) {
62
+ }, [F, T] = m(be()), [Q, x] = m(ke()), te = Be(o);
63
+ M && M !== E && B(M), w !== void 0 && w !== y && L(w), N !== void 0 && N !== F && T(N), te && JSON.stringify(o) !== JSON.stringify(te) && JSON.stringify(o) !== JSON.stringify(Q) && x(o), h(() => {
64
+ if (r.get("tagId") && q(Number.parseInt(r.get("tagId"))), r.get("search") && L(r.get("search")), r.get("sort")) {
65
65
  T(r.get("sort"));
66
66
  for (const e of r.values()) {
67
67
  i?.map((s) => {
@@ -80,7 +80,7 @@ const rt = ({
80
80
  break;
81
81
  }
82
82
  }, [I.search]), h(() => {
83
- _ ? (j(1), S([]), u(!0), se(1)) : u(!1);
83
+ _ ? (B(1), S([]), u(!0), se(1)) : u(!1);
84
84
  }, [
85
85
  F,
86
86
  Q,
@@ -97,7 +97,7 @@ const rt = ({
97
97
  delete e[n], t.setAddElements(e);
98
98
  }
99
99
  }, [t.addElements]), h(() => {
100
- if (t.updateElements && n in t.updateElements && t.updateElements[n].length > 0) {
100
+ if (t.updateElements && n in t.updateElements && (console.log("[PaginatedList] update received for listId:", n, t.updateElements[n]), t.updateElements[n].length > 0)) {
101
101
  xe(t.updateElements[n]);
102
102
  const e = t.updateElements;
103
103
  delete e[n], t.setUpdateElements(e);
@@ -115,7 +115,7 @@ const rt = ({
115
115
  [e.name]: e.value
116
116
  })) : (T(e.value), x(o ? { ...o } : {}));
117
117
  }, Fe = () => {
118
- typeof $ == "function" && $() !== null || j(E + 1);
118
+ typeof $ == "function" && $() !== null || B(E + 1);
119
119
  }, se = (e) => {
120
120
  const s = ae ? H.getListWithToken : H.getList;
121
121
  if ((e - 1) * p <= (Z || O) || e === 1) {
@@ -132,9 +132,9 @@ const rt = ({
132
132
  const f = l.headers;
133
133
  f && D in f && (Me(
134
134
  Number.parseInt(f[D || "total"], 10)
135
- ), W && W(f[D || "total"]));
135
+ ), U && U(f[D || "total"]));
136
136
  let g = l?.data?.data;
137
- R && R(g), z && (g = g.filter(z)), t.addElements && n in t.addElements && t.addElements[n].length > 0 && (g = [...t.addElements[n], g]), _e(g), u(!1);
137
+ R && R(g), W && (g = g.filter(W)), t.addElements && n in t.addElements && t.addElements[n].length > 0 && (g = [...t.addElements[n], g]), _e(g), u(!1);
138
138
  }).catch((l) => {
139
139
  console.error(l), l?.response?.status !== 404 && Ne(!0), u(!1);
140
140
  });
@@ -174,7 +174,7 @@ const rt = ({
174
174
  }) })
175
175
  },
176
176
  e[v || "id"]
177
- ) : null, Je = (e) => G ? /* @__PURE__ */ c("li", { className: a.paginatedListItem, children: G }, e) : null;
177
+ ) : null, Je = (e) => z ? /* @__PURE__ */ c("li", { className: a.paginatedListItem, children: z }, e) : null;
178
178
  if (we)
179
179
  throw new Error(
180
180
  J.formatMessage({
@@ -182,9 +182,9 @@ const rt = ({
182
182
  defaultMessage: "Error when loading content."
183
183
  })
184
184
  );
185
- return /* @__PURE__ */ U("div", { className: a.listContainer, children: [
185
+ return /* @__PURE__ */ P("div", { className: a.listContainer, children: [
186
186
  /* @__PURE__ */ c(
187
- ze,
187
+ We,
188
188
  {
189
189
  title: ue,
190
190
  sortOptions: i,
@@ -192,28 +192,28 @@ const rt = ({
192
192
  searchBar: ce,
193
193
  tagList: ne,
194
194
  activeTagId: C,
195
- onSearch: (e) => B(e),
195
+ onSearch: (e) => L(e),
196
196
  onSortChange: Ce,
197
197
  onTagChange: (e) => q(e),
198
198
  withUrlParams: Se
199
199
  }
200
200
  ),
201
- !b && k.length === 0 ? P ? /* @__PURE__ */ c("div", { className: a.emptyListElement, children: P }) : /* @__PURE__ */ c("div", { className: a.emptyList, children: V || J.formatMessage({
201
+ !b && k.length === 0 ? G ? /* @__PURE__ */ c("div", { className: a.emptyListElement, children: G }) : /* @__PURE__ */ c("div", { className: a.emptyList, children: V || J.formatMessage({
202
202
  id: "info.emptyList",
203
203
  defaultMessage: "No items for now."
204
- }) }) : /* @__PURE__ */ U(Le, { children: [
205
- /* @__PURE__ */ U(
204
+ }) }) : /* @__PURE__ */ P(je, { children: [
205
+ /* @__PURE__ */ P(
206
206
  "ul",
207
207
  {
208
- className: Be(a.paginatedList, {
209
- [a.paginatedListIsTablet]: !K && !L,
208
+ className: Le(a.paginatedList, {
209
+ [a.paginatedListIsTablet]: !K && !j,
210
210
  [a.centeredList]: X === "column",
211
211
  [a.column]: X === "column",
212
212
  [a.twoElementsPerLine]: Y === 2,
213
213
  [a.oneElementPerLine]: Y === 1,
214
214
  [a.indexLayoutList]: Ee,
215
- [a.listIsDesktop]: L,
216
- [a.listIsTablet]: ye && !L,
215
+ [a.listIsDesktop]: j,
216
+ [a.listIsTablet]: ye && !j,
217
217
  [a.listIsMobile]: K
218
218
  }),
219
219
  style: { gap: ge },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logora/debate",
3
- "version": "0.3.54",
3
+ "version": "0.3.55",
4
4
  "type": "module",
5
5
  "license": "AGPL-3.0",
6
6
  "description": "Design system of @Logora made with React",