@vonaffenfels/contentful-teasermanager 1.0.36 → 1.0.38

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vonaffenfels/contentful-teasermanager",
3
- "version": "1.0.36",
3
+ "version": "1.0.38",
4
4
  "scripts": {
5
5
  "prepublish": "yarn run build",
6
6
  "dev": "yarn run start",
@@ -98,7 +98,7 @@
98
98
  "@vonaffenfels/slate-editor": "^1.0.35",
99
99
  "webpack": "5.88.2"
100
100
  },
101
- "gitHead": "bef8a736da079b4fe1c79e5490d2bbca3c518772",
101
+ "gitHead": "2738647c77022116a4614f98b17c198a10d7d337",
102
102
  "publishConfig": {
103
103
  "access": "public"
104
104
  }
@@ -123,11 +123,26 @@ export const NewestArticles = ({
123
123
  <EntityList>
124
124
  {loading && <Spinner/>}
125
125
  {!loading && data.items.map((entry) => {
126
+ const isCurrentlySelectedInOtherSlot = !! Object.keys(slotState || {}).find(slot => slotState[slot] === entry.sys.id && slot !== slotId);
127
+ const isCurrentlySelectedInSlot = !!Object.keys(slotState || {}).find(slot => slotState[slot] === entry.sys.id && slot === slotId);
128
+
129
+ let status = "draft";
130
+ if (entry.sys.publishedAt) {
131
+ status = "published";
132
+ }
133
+
134
+ let description = "";
135
+ if (isCurrentlySelectedInSlot) {
136
+ description = "Aktuell ausgewählt";
137
+ } else if (isCurrentlySelectedInOtherSlot) {
138
+ description = "Aktuell in anderem Teaser ausgewählt"
139
+ }
140
+
126
141
  return <div
127
142
  key={entry.sys.id}
128
143
  className={classNames({
129
- "border-2 border-red-300": Object.keys(slotState || {}).find(slot => slotState[slot] === entry.sys.id && slot !== slotId),
130
- "border-2 border-green-300": Object.keys(slotState || {}).find(slot => slotState[slot] === entry.sys.id && slot === slotId),
144
+ "border-2 border-red-300": isCurrentlySelectedInSlot,
145
+ "border-2 border-green-300": isCurrentlySelectedInOtherSlot,
131
146
  })}
132
147
  >
133
148
  <EntityList.Item
@@ -136,8 +151,8 @@ export const NewestArticles = ({
136
151
  title={entry.fields.title?.de}
137
152
  onClick={() => onEntryClick(entry)}
138
153
  thumbnailUrl={getArticleThumbnailUrl(entry)}
139
- description={""}
140
- status={entry.sys.publishedAt ? "published" : "draft"}
154
+ description={description}
155
+ status={status}
141
156
  />
142
157
  </div>
143
158
  })}
@@ -8,7 +8,7 @@ const Dialog = ({sdk, portals, getArticleThumbnailUrl}) => {
8
8
  sdk.close(entry);
9
9
  }
10
10
 
11
- const loadSlotStateForPage = async (date) => {
11
+ const loadSlotStateForPage = async () => {
12
12
  try {
13
13
  const apiRoot = sdk.parameters.instance.apiRoot;
14
14
  const portal = sdk.parameters.invocation.portal;
@@ -29,7 +29,7 @@ const Dialog = ({sdk, portals, getArticleThumbnailUrl}) => {
29
29
 
30
30
  useEffect(() => {
31
31
  loadSlotStateForPage().then(setSlotState);
32
- }, []);
32
+ }, [sdk.parameters.invocation]);
33
33
 
34
34
  return <div style={{backgroundColor: "#FFFFFF", minHeight: "100vh"}}>
35
35
  <NewestArticles sdk={sdk} onEntryClick={selectEntry} slotState={slotState} getArticleThumbnailUrl={getArticleThumbnailUrl} portals={portals}/>
@@ -107,11 +107,14 @@ export const Timeline = ({
107
107
  {!!leftDate && Array(stepsInRange).fill(0).map((_, index) => {
108
108
  const dotDate = new Date(leftDate.getTime() + (15 * 60 * 1000 * (index + 1)));
109
109
  const stateChanged = timelineState?.[dotDate.toISOString()] || 0;
110
+ const currentDateCopy = new Date(currentDate);
111
+ currentDateCopy.setMilliseconds(0);
112
+ currentDateCopy.setSeconds(0);
110
113
 
111
114
  return <div
112
115
  key={index}
113
116
  className={classNames(styles.timelineDot, {
114
- [styles.timelineDotActive]: dotDate.getTime() === currentDate.getTime(),
117
+ [styles.timelineDotActive]: dotDate.getTime() === currentDateCopy.getTime(),
115
118
  [styles.timelineDotChanged]: !!stateChanged,
116
119
  })}
117
120
  onClick={e => {