@selfcommunity/react-ui 0.8.1-alpha.3 → 0.8.1-alpha.4

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.
@@ -117,7 +117,7 @@ function CategoriesPopularWidget(inProps) {
117
117
  const _categories = [...state.results];
118
118
  const updatedCategories = _categories.map((c) => (c.id === edited.id ? Object.assign(Object.assign({}, c), edited) : c));
119
119
  dispatch({ type: widget_1.actionWidgetTypes.SET_RESULTS, payload: { results: updatedCategories } });
120
- }, [dispatch]);
120
+ }, [dispatch, state.results]);
121
121
  /**
122
122
  * On mount, subscribe to receive event updates (only edit)
123
123
  */
@@ -113,7 +113,7 @@ function CategoriesSuggestionWidget(inProps) {
113
113
  const _categories = [...state.results];
114
114
  const updatedCategories = _categories.map((c) => (c.id === edited.id ? Object.assign(Object.assign({}, c), edited) : c));
115
115
  dispatch({ type: widget_1.actionWidgetTypes.SET_RESULTS, payload: { results: updatedCategories } });
116
- }, [dispatch]);
116
+ }, [dispatch, state.results]);
117
117
  /**
118
118
  * On mount, subscribe to receive event updates (only edit)
119
119
  */
@@ -5,15 +5,15 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const material_1 = require("@mui/material");
6
6
  const react_core_1 = require("@selfcommunity/react-core");
7
7
  const types_1 = require("@selfcommunity/types");
8
+ const pubsub_js_1 = tslib_1.__importDefault(require("pubsub-js"));
8
9
  const react_1 = require("react");
9
10
  const react_intl_1 = require("react-intl");
11
+ const PubSub_1 = require("../../constants/PubSub");
10
12
  const EventInfoDetails_1 = tslib_1.__importDefault(require("../../shared/EventInfoDetails"));
11
13
  const HiddenPlaceholder_1 = tslib_1.__importDefault(require("../../shared/HiddenPlaceholder"));
12
14
  const Widget_1 = tslib_1.__importDefault(require("../Widget"));
13
15
  const constants_1 = require("./constants");
14
16
  const Skeleton_1 = tslib_1.__importDefault(require("./Skeleton"));
15
- const pubsub_js_1 = tslib_1.__importDefault(require("pubsub-js"));
16
- const PubSub_1 = require("../../constants/PubSub");
17
17
  const classes = {
18
18
  root: `${constants_1.PREFIX}-root`,
19
19
  content: `${constants_1.PREFIX}-content`,
@@ -68,8 +68,10 @@ function EventInfoWidget(inProps) {
68
68
  const handleToggleSummary = (0, react_1.useCallback)(() => {
69
69
  setExpanded(!expanded);
70
70
  }, [expanded]);
71
- const showInfo = (0, react_1.useMemo)(() => (scEvent === null || scEvent === void 0 ? void 0 : scEvent.privacy) === types_1.SCEventPrivacyType.PUBLIC ||
72
- [types_1.SCEventSubscriptionStatusType.SUBSCRIBED, types_1.SCEventSubscriptionStatusType.GOING, types_1.SCEventSubscriptionStatusType.NOT_GOING].indexOf(scEvent === null || scEvent === void 0 ? void 0 : scEvent.subscription_status) > -1, [scEvent]);
71
+ const hasGeolocationOrLink = (0, react_1.useMemo)(() => Boolean((scEvent === null || scEvent === void 0 ? void 0 : scEvent.geolocation) || (scEvent === null || scEvent === void 0 ? void 0 : scEvent.link)), [scEvent]);
72
+ const showInfo = (0, react_1.useMemo)(() => ((scEvent === null || scEvent === void 0 ? void 0 : scEvent.privacy) === types_1.SCEventPrivacyType.PUBLIC && hasGeolocationOrLink) ||
73
+ ([types_1.SCEventSubscriptionStatusType.SUBSCRIBED, types_1.SCEventSubscriptionStatusType.GOING, types_1.SCEventSubscriptionStatusType.NOT_GOING].indexOf(scEvent === null || scEvent === void 0 ? void 0 : scEvent.subscription_status) > -1 &&
74
+ hasGeolocationOrLink), [scEvent]);
73
75
  const description = (0, react_1.useMemo)(() => (expanded ? scEvent === null || scEvent === void 0 ? void 0 : scEvent.description : getTruncatedText(scEvent === null || scEvent === void 0 ? void 0 : scEvent.description, 220)), [expanded, scEvent]);
74
76
  /**
75
77
  * Subscriber for pubsub callback
@@ -115,7 +115,7 @@ export default function CategoriesPopularWidget(inProps) {
115
115
  const _categories = [...state.results];
116
116
  const updatedCategories = _categories.map((c) => (c.id === edited.id ? Object.assign(Object.assign({}, c), edited) : c));
117
117
  dispatch({ type: actionWidgetTypes.SET_RESULTS, payload: { results: updatedCategories } });
118
- }, [dispatch]);
118
+ }, [dispatch, state.results]);
119
119
  /**
120
120
  * On mount, subscribe to receive event updates (only edit)
121
121
  */
@@ -111,7 +111,7 @@ export default function CategoriesSuggestionWidget(inProps) {
111
111
  const _categories = [...state.results];
112
112
  const updatedCategories = _categories.map((c) => (c.id === edited.id ? Object.assign(Object.assign({}, c), edited) : c));
113
113
  dispatch({ type: actionWidgetTypes.SET_RESULTS, payload: { results: updatedCategories } });
114
- }, [dispatch]);
114
+ }, [dispatch, state.results]);
115
115
  /**
116
116
  * On mount, subscribe to receive event updates (only edit)
117
117
  */
@@ -3,15 +3,15 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { Box, Button, CardContent, Icon, Stack, styled, Typography, useThemeProps } from '@mui/material';
4
4
  import { useSCFetchEvent } from '@selfcommunity/react-core';
5
5
  import { SCEventPrivacyType, SCEventSubscriptionStatusType } from '@selfcommunity/types';
6
+ import PubSub from 'pubsub-js';
6
7
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
7
8
  import { FormattedMessage } from 'react-intl';
9
+ import { SCGroupEventType, SCTopicType } from '../../constants/PubSub';
8
10
  import EventInfoDetails from '../../shared/EventInfoDetails';
9
11
  import HiddenPlaceholder from '../../shared/HiddenPlaceholder';
10
12
  import Widget from '../Widget';
11
13
  import { PREFIX } from './constants';
12
14
  import Skeleton from './Skeleton';
13
- import PubSub from 'pubsub-js';
14
- import { SCGroupEventType, SCTopicType } from '../../constants/PubSub';
15
15
  const classes = {
16
16
  root: `${PREFIX}-root`,
17
17
  content: `${PREFIX}-content`,
@@ -66,8 +66,10 @@ export default function EventInfoWidget(inProps) {
66
66
  const handleToggleSummary = useCallback(() => {
67
67
  setExpanded(!expanded);
68
68
  }, [expanded]);
69
- const showInfo = useMemo(() => (scEvent === null || scEvent === void 0 ? void 0 : scEvent.privacy) === SCEventPrivacyType.PUBLIC ||
70
- [SCEventSubscriptionStatusType.SUBSCRIBED, SCEventSubscriptionStatusType.GOING, SCEventSubscriptionStatusType.NOT_GOING].indexOf(scEvent === null || scEvent === void 0 ? void 0 : scEvent.subscription_status) > -1, [scEvent]);
69
+ const hasGeolocationOrLink = useMemo(() => Boolean((scEvent === null || scEvent === void 0 ? void 0 : scEvent.geolocation) || (scEvent === null || scEvent === void 0 ? void 0 : scEvent.link)), [scEvent]);
70
+ const showInfo = useMemo(() => ((scEvent === null || scEvent === void 0 ? void 0 : scEvent.privacy) === SCEventPrivacyType.PUBLIC && hasGeolocationOrLink) ||
71
+ ([SCEventSubscriptionStatusType.SUBSCRIBED, SCEventSubscriptionStatusType.GOING, SCEventSubscriptionStatusType.NOT_GOING].indexOf(scEvent === null || scEvent === void 0 ? void 0 : scEvent.subscription_status) > -1 &&
72
+ hasGeolocationOrLink), [scEvent]);
71
73
  const description = useMemo(() => (expanded ? scEvent === null || scEvent === void 0 ? void 0 : scEvent.description : getTruncatedText(scEvent === null || scEvent === void 0 ? void 0 : scEvent.description, 220)), [expanded, scEvent]);
72
74
  /**
73
75
  * Subscriber for pubsub callback