@@ -416,24 +416,25 @@ const ShowcaseHR = ({ className }: { className?: string }) => {
416
416
return (
417
417
< ShowcaseWrapper
418
418
className = { className }
419
- render = "https://refine.ams3.cdn.digitaloceanspaces.com/website/static/showcase-images/hr /base_render.png"
419
+ render = "https://refine.ams3.cdn.digitaloceanspaces.com/website/static/showcase-images/hr2 /base_render.png"
420
420
highlights = { [
421
421
{
422
- x : 268 ,
423
- y : 184 ,
424
- width : 496 ,
425
- height : 260 ,
422
+ x : 244 ,
423
+ y : 254 ,
424
+ width : 520 ,
425
+ height : 296 ,
426
426
render :
427
- "https://refine.ams3.cdn.digitaloceanspaces.com/website/static/showcase-images/hr/inbox .png" ,
427
+ "https://refine.ams3.cdn.digitaloceanspaces.com/website/static/showcase-images/hr2/notifications .png" ,
428
428
codePosition : "right" ,
429
429
code : `
430
430
import { useList } from "@refinedev/core";
431
431
432
432
const { data } = useList({
433
433
resource: "notifications",
434
+ liveMode: "auto",
434
435
filters: [
435
436
{
436
- field: "is_read ",
437
+ field: "isRead ",
437
438
operator: "eq",
438
439
value: false
439
440
},
@@ -444,65 +445,105 @@ const ShowcaseHR = ({ className }: { className?: string }) => {
444
445
{
445
446
x : 12 ,
446
447
y : 174 ,
447
- width : 200 ,
448
- height : 344 ,
448
+ width : 204 ,
449
+ height : 360 ,
449
450
render :
450
- "https://refine.ams3.cdn.digitaloceanspaces.com/website/static/showcase-images/hr/sider .png" ,
451
+ "https://refine.ams3.cdn.digitaloceanspaces.com/website/static/showcase-images/hr2/menu .png" ,
451
452
codePosition : "right" ,
452
453
code : `
453
- import { useMenu } from "@refinedev/core";
454
- import Link from "next/link";
455
-
456
- const { menuItems } = useMenu();
457
-
458
- return menuItems.map((item) => (
459
- <Link to={item.route}>
460
- {item.icon}
461
- {item.label}
462
- </Link>
463
- ));
464
- ` ,
454
+ import { useMenu, Link, CanAccess } from "@refinedev/core";
455
+ import { List, ListItem, ListItemButton, ListItemIcon, ListItemText } from "@mui/material";
456
+
457
+ const Sider = () => {
458
+ const { menuItems, selectedKey } = useMenu();
459
+ return (
460
+ <List>
461
+ {menuItems.map((item) => (
462
+ <CanAccess key={item.key} action="list" resource={item.name}>
463
+ <ListItem>
464
+ <ListItemButton component={Link} selected={selectedKey === item.key} to={item.route}>
465
+ <ListItemIcon>{item.icon}</ListItemIcon>
466
+ <ListItemText>{item.label}</ListItemText>
467
+ </ListItemButton>
468
+ </ListItem>
469
+ </CanAccess>
470
+ ))}
471
+ </List>
472
+ );
473
+ };
474
+ ` ,
465
475
} ,
466
476
{
467
477
x : 788 ,
468
- y : 184 ,
469
- width : 332 ,
470
- height : 260 ,
478
+ y : 254 ,
479
+ width : 356 ,
480
+ height : 296 ,
471
481
render :
472
- "https://refine.ams3.cdn.digitaloceanspaces.com/website/static/showcase-images/hr /poll.png" ,
482
+ "https://refine.ams3.cdn.digitaloceanspaces.com/website/static/showcase-images/hr2 /poll.png" ,
473
483
codePosition : "left" ,
474
484
code : `
475
- import { useList } from "@refinedev/core";
485
+ import { useList } from "@refinedev/core";
476
486
477
- const { data } = useList({
478
- resource: "polls",
479
- filters: [
480
- { field: "is_active", operator: "eq", value: true },
481
- ],
482
- pagination: { current: 1, pageSize: 1 }
483
- });
487
+ const { data } = useList({
488
+ resource: "polls",
489
+ filters: [{ field: "status", operator: "eq", value: "active" }],
490
+ pagination: { current: 1, pageSize: 1 },
491
+ liveMode: "auto",
492
+ });
484
493
` ,
485
494
} ,
486
495
{
487
- x : 736 ,
488
- y : 24 ,
489
- width : 384 ,
490
- height : 112 ,
496
+ x : 978 ,
497
+ y : 22 ,
498
+ width : 166 ,
499
+ height : 36 ,
491
500
render :
492
- "https://refine.ams3.cdn.digitaloceanspaces.com/website/static/showcase-images/hr/timer .png" ,
501
+ "https://refine.ams3.cdn.digitaloceanspaces.com/website/static/showcase-images/hr2/request-time-off .png" ,
493
502
codePosition : "left" ,
494
503
code : `
495
- import { useGetIdentity, useUpdate } from "@refinedev/core";
496
-
497
- const { data: { activeTaskId } } = useGetIdentity();
504
+ import { CreateButton } from "@refinedev/mui";
505
+ import { TimeOffIcon } from "@/icons";
498
506
499
- const { mutate } = useUpdate();
500
-
501
- const onBreak = () => mutate({
502
- resource: "tasks",
503
- id: activeTaskId,
504
- values: { is_paused: true },
505
- });
507
+ <CreateButton resource="time-offs" startIcon={<TimeOffIcon />}>
508
+ Request Time Off
509
+ </CreateButton>
510
+ ` ,
511
+ } ,
512
+ {
513
+ x : 552 ,
514
+ y : 78 ,
515
+ width : 284 ,
516
+ height : 128 ,
517
+ render :
518
+ "https://refine.ams3.cdn.digitaloceanspaces.com/website/static/showcase-images/hr2/sick-leave.png" ,
519
+ codePosition : "left" ,
520
+ code : `
521
+ import { useGetIdentity, useList } from "@refinedev/core";
522
+
523
+ const { data: { employeeId } } = useGetIdentity();
524
+
525
+ const { data } = useList({
526
+ resource: "time-offs",
527
+ pagination: { current: 1, pageSize: 1 },
528
+ filters: [
529
+ {
530
+ field: "employeeId",
531
+ operator: "eq",
532
+ value: employeeId,
533
+ },
534
+ {
535
+ field: "status",
536
+ operator: "eq",
537
+ value: "approved",
538
+ },
539
+ {
540
+ field: "type",
541
+ operator: "eq",
542
+ value: "sick-leave",
543
+ },
544
+ ],
545
+ });
546
+ const totalSickLeave = data?.total;
506
547
` ,
507
548
} ,
508
549
] }
0 commit comments