ywana-core8 0.0.824 → 0.0.825

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": "ywana-core8",
3
- "version": "0.0.824",
3
+ "version": "0.0.825",
4
4
  "description": "ywana-core8",
5
5
  "homepage": "https://ywana.github.io/workspace",
6
6
  "author": "Ernesto Roldan Garcia",
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useMemo, useState, useRef } from "react";
1
+ import React, { useEffect, useMemo, useState, useRef, useCallback } from "react";
2
2
  import { DropDown, Header, Icon, Text, TextField, Button } from "../../html";
3
3
  import moment from "moment";
4
4
  import { extendMoment } from "moment-range";
@@ -20,11 +20,18 @@ export const Planner = ({ title, events = [], lanes = [], navigation = true, onS
20
20
  const [dateRange, setDateRange] = useState(config.range);
21
21
  const [from, setFrom] = useState(config.from);
22
22
  const [to, setTo] = useState(config.to);
23
- const thisMondayElement = useRef(null)
24
23
 
25
- useEffect(() => {
26
- if (thisMondayElement.current) { showThisWeek() }
27
- }, [thisMondayElement])
24
+ const thisMondayElement = useRef(null)
25
+
26
+ const gotoMonday = useCallback(node => {
27
+ const element = node
28
+ console.log("goto monday", element)
29
+ if (element) element.scrollIntoView({
30
+ behavior: 'smooth',
31
+ block: 'start',
32
+ inline: 'start',
33
+ })
34
+ }, [])
28
35
 
29
36
  useEffect(() => {
30
37
  const element = document.getElementById(focusEvent)
@@ -68,6 +75,7 @@ export const Planner = ({ title, events = [], lanes = [], navigation = true, onS
68
75
  function showThisWeek() {
69
76
  const element = thisMondayElement.current
70
77
  //const element = document.querySelector(".thisMonday")
78
+ console.log("Show this week", element)
71
79
  if (element) element.scrollIntoView({
72
80
  behavior: 'smooth',
73
81
  block: 'start',
@@ -135,16 +143,15 @@ export const Planner = ({ title, events = [], lanes = [], navigation = true, onS
135
143
  const today = moment()
136
144
  var weekStart = today.clone().startOf('week')
137
145
  const isThisMonday = (date.moment.isSame(weekStart))
138
-
139
146
  return (
140
- <div key={`column-${date.moment.dayOfYear()}`} className="column-header" ref={isThisMonday ? thisMondayElement : null}>
141
- <div className={`date-header ${weekend} ${thisWeek}`}>
147
+ <div key={`column-${date.moment.dayOfYear()}`} id={isThisMonday ? "thisMonday" : ""} className="column-header" ref={isThisMonday ? thisMondayElement : null}>
148
+ <div className={`date-header ${weekend} ${thisWeek}`} ref={isThisMonday ? gotoMonday : null}>
142
149
  <Text use="headline6">{date.moment.format("DD")}</Text>
143
150
  &nbsp;
144
151
  <Text use="caption">{date.moment.format("ddd")}</Text>
145
152
  </div>
146
153
  </div>
147
- );
154
+ )
148
155
  })}
149
156
  </div>
150
157