Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
actual-vt-capstone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
danieljk
actual-vt-capstone
Commits
c311d4a8
Unverified
Commit
c311d4a8
authored
10 months ago
by
Matiss Janis Aboltins
Committed by
GitHub
10 months ago
Browse files
Options
Downloads
Patches
Plain Diff
fix recurring schedule datepicker - port to new Popover (#2766)
parent
1fc7c997
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
packages/desktop-client/src/components/select/RecurringSchedulePicker.jsx
+31
-28
31 additions, 28 deletions
...-client/src/components/select/RecurringSchedulePicker.jsx
upcoming-release-notes/2766.md
+6
-0
6 additions, 0 deletions
upcoming-release-notes/2766.md
with
37 additions
and
28 deletions
packages/desktop-client/src/components/select/RecurringSchedulePicker.jsx
+
31
−
28
View file @
c311d4a8
import
React
,
{
useEffect
,
useReducer
,
useState
}
from
'
react
'
;
import
React
,
{
useEffect
,
useReducer
,
useRef
,
useState
}
from
'
react
'
;
import
{
sendCatch
}
from
'
loot-core/src/platform/client/fetch
'
;
import
{
sendCatch
}
from
'
loot-core/src/platform/client/fetch
'
;
import
*
as
monthUtils
from
'
loot-core/src/shared/months
'
;
import
*
as
monthUtils
from
'
loot-core/src/shared/months
'
;
...
@@ -9,12 +9,12 @@ import { SvgAdd, SvgSubtract } from '../../icons/v0';
...
@@ -9,12 +9,12 @@ import { SvgAdd, SvgSubtract } from '../../icons/v0';
import
{
theme
}
from
'
../../style
'
;
import
{
theme
}
from
'
../../style
'
;
import
{
Button
}
from
'
../common/Button
'
;
import
{
Button
}
from
'
../common/Button
'
;
import
{
Input
}
from
'
../common/Input
'
;
import
{
Input
}
from
'
../common/Input
'
;
import
{
Popover
}
from
'
../common/Popover
'
;
import
{
Select
}
from
'
../common/Select
'
;
import
{
Select
}
from
'
../common/Select
'
;
import
{
Stack
}
from
'
../common/Stack
'
;
import
{
Stack
}
from
'
../common/Stack
'
;
import
{
Text
}
from
'
../common/Text
'
;
import
{
Text
}
from
'
../common/Text
'
;
import
{
View
}
from
'
../common/View
'
;
import
{
View
}
from
'
../common/View
'
;
import
{
Checkbox
}
from
'
../forms
'
;
import
{
Checkbox
}
from
'
../forms
'
;
import
{
useTooltip
,
Tooltip
}
from
'
../tooltips
'
;
import
{
DateSelect
}
from
'
./DateSelect
'
;
import
{
DateSelect
}
from
'
./DateSelect
'
;
...
@@ -48,19 +48,18 @@ function parsePatternValue(value) {
...
@@ -48,19 +48,18 @@ function parsePatternValue(value) {
}
}
function
parseConfig
(
config
)
{
function
parseConfig
(
config
)
{
return
(
return
{
config
||
{
start
:
monthUtils
.
currentDay
(),
start
:
monthUtils
.
currentDay
(),
interval
:
1
,
interval
:
1
,
frequency
:
'
monthly
'
,
frequency
:
'
monthly
'
,
patterns
:
[
createMonthlyRecurrence
(
monthUtils
.
currentDay
())],
patterns
:
[
createMonthlyRecurrence
(
monthUtils
.
currentDay
())],
skipWeekend
:
false
,
skipWeekend
:
false
,
weekendSolveMode
:
'
before
'
,
weekendSolveMode
:
'
before
'
,
endMode
:
'
never
'
,
endMode
:
'
never
'
,
endOccurrences
:
'
1
'
,
endOccurrences
:
'
1
'
,
endDate
:
monthUtils
.
currentDay
(),
endDate
:
monthUtils
.
currentDay
(),
...
config
,
}
};
);
}
}
function
unparseConfig
(
parsed
)
{
function
unparseConfig
(
parsed
)
{
...
@@ -309,12 +308,7 @@ function RecurringScheduleTooltip({ config: currentConfig, onClose, onSave }) {
...
@@ -309,12 +308,7 @@ function RecurringScheduleTooltip({ config: currentConfig, onClose, onSave }) {
}
}
return
(
return
(
<
Tooltip
<>
style
=
{
{
padding
:
10
,
width
:
380
}
}
offset
=
{
1
}
position
=
"bottom-left"
onClose
=
{
onClose
}
>
<
div
style
=
{
{
display
:
'
flex
'
,
alignItems
:
'
center
'
,
gap
:
5
}
}
>
<
div
style
=
{
{
display
:
'
flex
'
,
alignItems
:
'
center
'
,
gap
:
5
}
}
>
<
label
htmlFor
=
"start"
>
From
</
label
>
<
label
htmlFor
=
"start"
>
From
</
label
>
<
DateSelect
<
DateSelect
...
@@ -471,36 +465,45 @@ function RecurringScheduleTooltip({ config: currentConfig, onClose, onSave }) {
...
@@ -471,36 +465,45 @@ function RecurringScheduleTooltip({ config: currentConfig, onClose, onSave }) {
Apply
Apply
</
Button
>
</
Button
>
</
div
>
</
div
>
</
Tooltip
>
</>
);
);
}
}
export
function
RecurringSchedulePicker
({
value
,
buttonStyle
,
onChange
})
{
export
function
RecurringSchedulePicker
({
value
,
buttonStyle
,
onChange
})
{
const
{
isOpen
,
close
,
getOpenEvents
}
=
useTooltip
();
const
triggerRef
=
useRef
(
null
);
const
[
isOpen
,
setIsOpen
]
=
useState
(
false
);
const
dateFormat
=
useDateFormat
()
||
'
MM/dd/yyyy
'
;
const
dateFormat
=
useDateFormat
()
||
'
MM/dd/yyyy
'
;
function
onSave
(
config
)
{
function
onSave
(
config
)
{
onChange
(
config
);
onChange
(
config
);
clo
se
(
);
setIsOpen
(
fal
se
);
}
}
return
(
return
(
<
View
>
<
View
>
<
Button
<
Button
{
...
getOpenEvents
()
}
ref
=
{
triggerRef
}
style
=
{
{
textAlign
:
'
left
'
,
...
buttonStyle
}
}
style
=
{
{
textAlign
:
'
left
'
,
...
buttonStyle
}
}
onClick
=
{
()
=>
setIsOpen
(
true
)
}
>
>
{
value
{
value
?
getRecurringDescription
(
value
,
dateFormat
)
?
getRecurringDescription
(
value
,
dateFormat
)
:
'
No recurring date
'
}
:
'
No recurring date
'
}
</
Button
>
</
Button
>
{
isOpen
&&
(
<
Popover
triggerRef
=
{
triggerRef
}
style
=
{
{
padding
:
10
,
width
:
380
}
}
placement
=
"bottom start"
isOpen
=
{
isOpen
}
onOpenChange
=
{
()
=>
setIsOpen
(
false
)
}
>
<
RecurringScheduleTooltip
<
RecurringScheduleTooltip
config
=
{
value
}
config
=
{
value
}
onClose
=
{
clo
se
}
onClose
=
{
()
=>
setIsOpen
(
fal
se
)
}
onSave
=
{
onSave
}
onSave
=
{
onSave
}
/>
/>
)
}
</
Popover
>
</
View
>
</
View
>
);
);
}
}
This diff is collapsed.
Click to expand it.
upcoming-release-notes/2766.md
0 → 100644
+
6
−
0
View file @
c311d4a8
---
category
:
Maintenance
authors
:
[
MatissJanis
]
---
Migrating recurring schedule
`Tooltip`
component to react-aria Tooltip/Popover (vol.5)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment