@vonaffenfels/contentful-teasermanager 1.0.27 → 1.0.28

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.27",
3
+ "version": "1.0.28",
4
4
  "scripts": {
5
5
  "prepublish": "yarn run build",
6
6
  "dev": "yarn run start",
@@ -96,10 +96,10 @@
96
96
  "webpack-dev-server": "^4.0.0-beta.2"
97
97
  },
98
98
  "dependencies": {
99
- "@vonaffenfels/slate-editor": "^1.0.26",
100
- "webpack": "5.73.0"
99
+ "@vonaffenfels/slate-editor": "^1.0.28",
100
+ "webpack": "5.88.2"
101
101
  },
102
- "gitHead": "148d5745884b9e253e56a2389662fc4f7ecf4254",
102
+ "gitHead": "fe5a1e14e437b67a1aa58fa6781b9ae134914750",
103
103
  "publishConfig": {
104
104
  "access": "public"
105
105
  }
@@ -57,7 +57,7 @@ export const Timeline = ({
57
57
 
58
58
  return <div className="flex w-full">
59
59
  <div className={styles.wrapper}>
60
- <div className={styles.date}>
60
+ <div className="w-full h-auto text-center py-2">
61
61
  {!!currentDate && (
62
62
  <>
63
63
  <input type="date" value={format(currentDate, "yyyy-MM-dd")} onChange={handleDateChange} className="mr-2 w-auto" />
@@ -96,8 +96,7 @@ const TimeSelect = ({
96
96
  let options = [];
97
97
 
98
98
  for (let i = 1; i <= 24; i++) {
99
- console.log(i);
100
- options.push(<option value={i} style={{padding: "8px"}}>{i < 10 ? `0${i}` : i}</option>);
99
+ options.push(<option key={`hour-option-${i}`} value={i} style={{padding: "8px"}}>{i < 10 ? `0${i}` : i}</option>);
101
100
  }
102
101
 
103
102
  return options;
@@ -107,8 +106,7 @@ const TimeSelect = ({
107
106
  let options = [];
108
107
 
109
108
  for (let i = 0; i <= 60; i += 15) {
110
- console.log(i);
111
- options.push(<option value={i} style={{padding: "8px"}}>{i < 10 ? `0${i}` : i}</option>);
109
+ options.push(<option key={`minute-option-${i}`} value={i} style={{padding: "8px"}}>{i < 10 ? `0${i}` : i}</option>);
112
110
  }
113
111
 
114
112
  return options;
@@ -8,7 +8,7 @@
8
8
 
9
9
  .timeline {
10
10
  height: auto;
11
- padding: 6px 0 12px 0;
11
+ padding: 30px 0 12px 0;
12
12
  width: 100%;
13
13
  display: flex;
14
14
  font-weight: bold;
@@ -48,10 +48,4 @@
48
48
  left: -100px;
49
49
  width: 200px;
50
50
  text-align: center;
51
- }
52
-
53
- .date {
54
- width: 100%;
55
- text-align: center;
56
- padding: 20px 0 30px 0;
57
51
  }
@@ -90,7 +90,7 @@ export const Teasermanager = ({
90
90
  }
91
91
 
92
92
  setLoading(true);
93
- runLoaders(contentValue, portalValue).then(content => {
93
+ runLoaders(contentValue, portalValue, entry?.sys?.id).then(content => {
94
94
  setLoadedContent(content);
95
95
  setLoading(false);
96
96
  });
@@ -1,11 +1,11 @@
1
- export const runLoaders = async (value, portal) => {
1
+ export const runLoaders = async (value, portal, contextId) => {
2
2
  if (!Array.isArray(value)) {
3
3
  return value;
4
4
  }
5
5
 
6
6
  const newValue = await Promise.all(value.map(async (item) => {
7
7
  try {
8
- return await runLoader(item, portal)
8
+ return await runLoader(item, portal, contextId)
9
9
  } catch (e) {
10
10
  console.error(e);
11
11
  return item;
@@ -15,13 +15,16 @@ export const runLoaders = async (value, portal) => {
15
15
  return newValue;
16
16
  }
17
17
 
18
- const runLoader = async (item, portal) => {
18
+ const runLoader = async (item, portal, contextId) => {
19
19
 
20
20
  if (!item?.block) {
21
21
  return item;
22
22
  }
23
23
  try {
24
- const response = await fetch(`/api/loader/?portal=${portal}&block=${item.block}&variables=${JSON.stringify(item.attributes)}`).then(res => res.json());
24
+ const response = await fetch(`/api/loader/?portal=${portal}&block=${item.block}`, {
25
+ method: "POST",
26
+ body: JSON.stringify({variables: item.attributes, context: {activeContent: {sys: {id: contextId}}}}),
27
+ }).then(res => res.json());
25
28
 
26
29
  return {
27
30
  ...item,