Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
Infoscreen
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
falk-pages
Infoscreen
Commits
723fd71d
Unverified
Commit
723fd71d
authored
Jul 7, 2024
by
Marvin Jütte
Browse files
Options
Downloads
Patches
Plain Diff
add progress bar for canteen plan
parent
a4f5585b
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/index.css
+25
-0
25 additions, 0 deletions
src/index.css
src/meta/ProgressBar.tsx
+25
-0
25 additions, 0 deletions
src/meta/ProgressBar.tsx
src/panels/Mensaplan/MensaplanPanel.tsx
+17
-21
17 additions, 21 deletions
src/panels/Mensaplan/MensaplanPanel.tsx
with
67 additions
and
21 deletions
src/index.css
+
25
−
0
View file @
723fd71d
...
...
@@ -17,6 +17,31 @@
cursor
:
none
;
}
.progress-bar
{
justify-content
:
center
;
border-radius
:
10px
;
padding
:
0
5px
;
display
:
flex
;
height
:
10px
;
width
:
100%
;
;
}
.progress-bar-fill
{
border-radius
:
10px
;
height
:
10px
;
width
:
0
;
animation-timing-function
:
linear
;
}
.progress-bar-animate
{
animation-name
:
progress-bar-animation
;
}
@keyframes
progress-bar-animation
{
0%
{
width
:
0
;
}
100%
{
width
:
100%
;
}
}
/* inter-200 - latin_latin-ext */
@font-face
{
font-display
:
swap
;
/* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
...
...
This diff is collapsed.
Click to expand it.
src/meta/ProgressBar.tsx
0 → 100644
+
25
−
0
View file @
723fd71d
const
ProgressBar
=
(
props
:
{
duration
:
number
,
idName
:
string
,
callbackFunction
:
()
=>
void
})
=>
{
const
runCallback
=
()
=>
{
props
.
callbackFunction
();
const
el
=
document
.
getElementById
(
props
.
idName
);
if
(
el
)
{
el
.
classList
.
remove
(
'
progress-bar-animate
'
);
void
el
.
offsetWidth
;
el
.
classList
.
add
(
'
progress-bar-animate
'
);
}
}
return
(
<
div
className
=
"progress-bar"
>
<
div
id
=
{
props
.
idName
}
className
=
{
'
progress-bar-fill progress-bar-animate bg-zinc-700
'
}
style
=
{
{
animationDuration
:
`
${
props
.
duration
}
ms`
}
}
onAnimationEnd
=
{
()
=>
runCallback
()
}
/>
</
div
>
);
};
export
default
ProgressBar
;
This diff is collapsed.
Click to expand it.
src/panels/Mensaplan/MensaplanPanel.tsx
+
17
−
21
View file @
723fd71d
...
...
@@ -4,6 +4,7 @@ import PanelTitle from "../../meta/PanelTitle";
import
PanelContent
from
"
../../meta/PanelContent
"
;
import
{
CanteenAPIResponse
}
from
"
./types/canteenAPI
"
;
import
{
Leaf
,
Plant
,
Bone
,
Record
,
Fish
,
ForkKnife
}
from
"
@phosphor-icons/react
"
;
import
ProgressBar
from
"
../../meta/ProgressBar
"
;
type
Dish
=
{
name
:
string
,
...
...
@@ -138,9 +139,9 @@ const MensaplanPanel = (props: {definition: MensaPanelDefinition}) => {
// eslint-disable-next-line react-hooks/exhaustive-deps
},
[]);
useEffect
(
()
=>
{
c
onst
update
=
async
()
=>
{
switch
(
cycle
.
current
%
2
)
{
const
updateGroup
=
()
=>
{
c
ycle
.
current
=
(
cycle
.
current
+
1
)
%
2
;
switch
(
cycle
.
current
)
{
case
0
:
setGroupName
(
"
Menüs
"
);
setDishes
(
menus
.
current
);
...
...
@@ -149,18 +150,12 @@ const MensaplanPanel = (props: {definition: MensaPanelDefinition}) => {
setGroupName
(
"
Aktionsteller
"
);
setDishes
(
specials
.
current
);
break
;
default
:
console
.
error
(
"
You fucked up bad!
"
);
break
;
}
cycle
.
current
=
(
cycle
.
current
+
1
)
%
2
;
}
update
();
const
interval
=
setInterval
(
update
,
20
*
1000
);
return
()
=>
{
clearInterval
(
interval
);
}
},
[]);
return
(
<
PanelWrapper
>
...
...
@@ -206,6 +201,7 @@ const MensaplanPanel = (props: {definition: MensaPanelDefinition}) => {
</
div
>
)
}
</
PanelContent
>
<
ProgressBar
duration
=
{
20000
}
idName
=
{
'
mena-progress
'
}
callbackFunction
=
{
updateGroup
}
/>
</
PanelWrapper
>
);
};
...
...
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