ywana-core8 0.0.828 → 0.0.830
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/index.cjs +14 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +14 -3
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +14 -3
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/incubator/calendar.css +41 -0
- package/src/incubator/calendar.js +66 -0
- package/src/incubator/task.js +1 -5
package/package.json
CHANGED
@@ -0,0 +1,41 @@
|
|
1
|
+
.calendar-row {
|
2
|
+
border: solid 1px rgb(0, 0, 0);
|
3
|
+
overflow-x: auto;
|
4
|
+
}
|
5
|
+
|
6
|
+
.months-row {
|
7
|
+
display: flex;
|
8
|
+
overflow: visible;
|
9
|
+
}
|
10
|
+
|
11
|
+
.month-cell {
|
12
|
+
border: solid 1px rgb(220, 220, 220);
|
13
|
+
min-width: 3rem;
|
14
|
+
height: 1.4rem;
|
15
|
+
display: flex;
|
16
|
+
flex-direction: column;
|
17
|
+
align-items: center;
|
18
|
+
justify-content: center;
|
19
|
+
}
|
20
|
+
|
21
|
+
.day-cell {
|
22
|
+
padding: .5rem 0;
|
23
|
+
border: solid 1px rgb(220, 220, 220);
|
24
|
+
display: flex;
|
25
|
+
flex-direction: column;
|
26
|
+
align-items: center;
|
27
|
+
justify-content: center;
|
28
|
+
|
29
|
+
}
|
30
|
+
|
31
|
+
.weekday {
|
32
|
+
font-size: .6rem;
|
33
|
+
font-weight: 400;
|
34
|
+
color:rgb(143, 143, 143)
|
35
|
+
}
|
36
|
+
|
37
|
+
.daynum {
|
38
|
+
font-size: .8rem;
|
39
|
+
font-weight: 600;
|
40
|
+
padding: .2rem 0;
|
41
|
+
}
|
@@ -0,0 +1,66 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import "./calendar.css"
|
3
|
+
|
4
|
+
|
5
|
+
export const Calendar = ({ from, to }) => {
|
6
|
+
const days = [];
|
7
|
+
const day = new Date(from);
|
8
|
+
const lastDay = new Date(to);
|
9
|
+
while (day <= lastDay) {
|
10
|
+
days.push({
|
11
|
+
day: day.getDate(),
|
12
|
+
weekday: day.toLocaleString('en-US', { weekday: 'short' }),
|
13
|
+
month: day.toLocaleString('en-US', { month: 'short' }),
|
14
|
+
});
|
15
|
+
day.setDate(day.getDate() + 1);
|
16
|
+
}
|
17
|
+
|
18
|
+
const uniqueMonths = Array.from(
|
19
|
+
new Set(days.map(({ month }) => month))
|
20
|
+
);
|
21
|
+
|
22
|
+
const monthWidths = uniqueMonths.map((month) => {
|
23
|
+
const monthDays = days.filter((day) => day.month === month);
|
24
|
+
return `${monthDays.length * 2}rem`;
|
25
|
+
});
|
26
|
+
|
27
|
+
const dayWidth = '2rem';
|
28
|
+
|
29
|
+
return (
|
30
|
+
<div className='calendar-row'>
|
31
|
+
<div className="months-row" style={{ display: 'flex' }}>
|
32
|
+
{uniqueMonths.map((month, index) => (
|
33
|
+
<div
|
34
|
+
className="month-cell"
|
35
|
+
key={month}
|
36
|
+
style={{
|
37
|
+
flex: '0 0 auto',
|
38
|
+
textAlign: 'center',
|
39
|
+
fontWeight: 'bold',
|
40
|
+
width: monthWidths[index],
|
41
|
+
}}
|
42
|
+
>
|
43
|
+
{month} {new Date(from).getFullYear()}
|
44
|
+
</div>
|
45
|
+
))}
|
46
|
+
</div>
|
47
|
+
<div style={{ display: 'flex' }}>
|
48
|
+
{days.map(({ day, weekday, month }) => (
|
49
|
+
<div className='day-cell' key={day} style={{ flex: 1, textAlign: 'center', minWidth: dayWidth }}>
|
50
|
+
<div className="weekday">{weekday.substring(0,2)}</div>
|
51
|
+
<div className="daynum">{day}</div>
|
52
|
+
</div>
|
53
|
+
))}
|
54
|
+
</div>
|
55
|
+
</div>
|
56
|
+
);
|
57
|
+
};
|
58
|
+
|
59
|
+
|
60
|
+
const CalendarTest = (props) => {
|
61
|
+
return (
|
62
|
+
<>
|
63
|
+
<Calendar from="2023-01-01" to="2023-03-03" />
|
64
|
+
</>
|
65
|
+
)
|
66
|
+
}
|
package/src/incubator/task.js
CHANGED
@@ -20,7 +20,6 @@ export const TaskContextProvider = (props) => {
|
|
20
20
|
|
21
21
|
async function tasks(filters, likes) {
|
22
22
|
try {
|
23
|
-
console.log("tasks", filters)
|
24
23
|
const response = await API.all(filters, likes);
|
25
24
|
return response;
|
26
25
|
} catch (error) {
|
@@ -75,9 +74,7 @@ export const TaskContextProvider = (props) => {
|
|
75
74
|
|
76
75
|
useEffect(() => {
|
77
76
|
const interval = setInterval(async () => {
|
78
|
-
const tasks = await API.all()
|
79
|
-
|
80
|
-
// find task for each listener
|
77
|
+
const tasks = await API.all({ state: TASK_STATES.RUNNING})
|
81
78
|
Object.keys(_listeners).forEach(taskID => {
|
82
79
|
const task = tasks.find(task => task.id === taskID)
|
83
80
|
if (task) {
|
@@ -85,7 +82,6 @@ export const TaskContextProvider = (props) => {
|
|
85
82
|
if (listener) listener(task)
|
86
83
|
}
|
87
84
|
})
|
88
|
-
|
89
85
|
}, frequency)
|
90
86
|
return () => clearInterval(interval)
|
91
87
|
}, [])
|