@isma91/react-scheduler 4.0.0

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.
Files changed (134) hide show
  1. package/.github/workflows/publish.yml +29 -0
  2. package/.github/workflows/tests.yml +35 -0
  3. package/.gitignore +32 -0
  4. package/.husky/pre-commit +2 -0
  5. package/.prettierignore +1 -0
  6. package/.prettierrc.json +7 -0
  7. package/.yarnrc.yml +1 -0
  8. package/LICENSE +24 -0
  9. package/README.md +172 -0
  10. package/dist/LICENSE +24 -0
  11. package/dist/README.md +172 -0
  12. package/dist/SchedulerComponent.d.ts +3 -0
  13. package/dist/components/common/Cell.d.ts +13 -0
  14. package/dist/components/common/LocaleArrow.d.ts +8 -0
  15. package/dist/components/common/ResourceHeader.d.ts +6 -0
  16. package/dist/components/common/Tabs.d.ts +16 -0
  17. package/dist/components/common/TodayTypo.d.ts +8 -0
  18. package/dist/components/common/WithResources.d.ts +6 -0
  19. package/dist/components/events/Actions.d.ts +8 -0
  20. package/dist/components/events/AgendaEventsList.d.ts +7 -0
  21. package/dist/components/events/CurrentTimeBar.d.ts +11 -0
  22. package/dist/components/events/EmptyAgenda.d.ts +2 -0
  23. package/dist/components/events/EventItem.d.ts +10 -0
  24. package/dist/components/events/EventItemPopover.d.ts +9 -0
  25. package/dist/components/events/MonthEvents.d.ts +13 -0
  26. package/dist/components/events/TodayEvents.d.ts +16 -0
  27. package/dist/components/hoc/DateProvider.d.ts +5 -0
  28. package/dist/components/inputs/DatePicker.d.ts +14 -0
  29. package/dist/components/inputs/Input.d.ts +19 -0
  30. package/dist/components/inputs/SelectInput.d.ts +22 -0
  31. package/dist/components/month/MonthTable.d.ts +8 -0
  32. package/dist/components/nav/DayDateBtn.d.ts +6 -0
  33. package/dist/components/nav/MonthDateBtn.d.ts +6 -0
  34. package/dist/components/nav/Navigation.d.ts +3 -0
  35. package/dist/components/nav/WeekDateBtn.d.ts +8 -0
  36. package/dist/components/week/WeekTable.d.ts +11 -0
  37. package/dist/helpers/constants.d.ts +4 -0
  38. package/dist/helpers/generals.d.ts +78 -0
  39. package/dist/hooks/useArrowDisable.d.ts +5 -0
  40. package/dist/hooks/useCellAttributes.d.ts +18 -0
  41. package/dist/hooks/useDragAttributes.d.ts +10 -0
  42. package/dist/hooks/useEventPermissions.d.ts +7 -0
  43. package/dist/hooks/useStore.d.ts +2 -0
  44. package/dist/hooks/useSyncScroll.d.ts +8 -0
  45. package/dist/hooks/useWindowResize.d.ts +4 -0
  46. package/dist/index.d.ts +3 -0
  47. package/dist/index.js +2853 -0
  48. package/dist/package.json +65 -0
  49. package/dist/positionManger/context.d.ts +14 -0
  50. package/dist/positionManger/provider.d.ts +5 -0
  51. package/dist/positionManger/usePosition.d.ts +4 -0
  52. package/dist/store/context.d.ts +2 -0
  53. package/dist/store/default.d.ts +245 -0
  54. package/dist/store/provider.d.ts +7 -0
  55. package/dist/store/types.d.ts +27 -0
  56. package/dist/styles/styles.d.ts +30 -0
  57. package/dist/types.d.ts +372 -0
  58. package/dist/views/Day.d.ts +2 -0
  59. package/dist/views/DayAgenda.d.ts +7 -0
  60. package/dist/views/Editor.d.ts +11 -0
  61. package/dist/views/Month.d.ts +2 -0
  62. package/dist/views/MonthAgenda.d.ts +7 -0
  63. package/dist/views/Week.d.ts +2 -0
  64. package/dist/views/WeekAgenda.d.ts +8 -0
  65. package/eslint.config.js +79 -0
  66. package/index.html +41 -0
  67. package/jest.config.ts +194 -0
  68. package/package.json +137 -0
  69. package/public/favicon.ico +0 -0
  70. package/public/logo192.png +0 -0
  71. package/public/logo512.png +0 -0
  72. package/public/manifest.json +25 -0
  73. package/public/robots.txt +3 -0
  74. package/scripts/post-pack.js +34 -0
  75. package/src/App.tsx +25 -0
  76. package/src/Page1.tsx +67 -0
  77. package/src/events.tsx +227 -0
  78. package/src/index.tsx +21 -0
  79. package/src/lib/SchedulerComponent.tsx +78 -0
  80. package/src/lib/__tests__/index.test.tsx +24 -0
  81. package/src/lib/components/common/Cell.tsx +52 -0
  82. package/src/lib/components/common/LocaleArrow.tsx +38 -0
  83. package/src/lib/components/common/ResourceHeader.tsx +73 -0
  84. package/src/lib/components/common/Tabs.tsx +119 -0
  85. package/src/lib/components/common/TodayTypo.tsx +44 -0
  86. package/src/lib/components/common/WithResources.tsx +98 -0
  87. package/src/lib/components/events/Actions.tsx +65 -0
  88. package/src/lib/components/events/AgendaEventsList.tsx +115 -0
  89. package/src/lib/components/events/CurrentTimeBar.tsx +59 -0
  90. package/src/lib/components/events/EmptyAgenda.tsx +27 -0
  91. package/src/lib/components/events/EventItem.tsx +180 -0
  92. package/src/lib/components/events/EventItemPopover.tsx +179 -0
  93. package/src/lib/components/events/MonthEvents.tsx +141 -0
  94. package/src/lib/components/events/TodayEvents.tsx +99 -0
  95. package/src/lib/components/hoc/DateProvider.tsx +19 -0
  96. package/src/lib/components/inputs/DatePicker.tsx +95 -0
  97. package/src/lib/components/inputs/Input.tsx +113 -0
  98. package/src/lib/components/inputs/SelectInput.tsx +164 -0
  99. package/src/lib/components/month/MonthTable.tsx +207 -0
  100. package/src/lib/components/nav/DayDateBtn.tsx +77 -0
  101. package/src/lib/components/nav/MonthDateBtn.tsx +80 -0
  102. package/src/lib/components/nav/Navigation.tsx +201 -0
  103. package/src/lib/components/nav/WeekDateBtn.tsx +89 -0
  104. package/src/lib/components/week/WeekTable.tsx +229 -0
  105. package/src/lib/helpers/constants.ts +4 -0
  106. package/src/lib/helpers/generals.tsx +354 -0
  107. package/src/lib/hooks/useArrowDisable.ts +26 -0
  108. package/src/lib/hooks/useCellAttributes.ts +67 -0
  109. package/src/lib/hooks/useDragAttributes.ts +31 -0
  110. package/src/lib/hooks/useEventPermissions.ts +42 -0
  111. package/src/lib/hooks/useStore.ts +8 -0
  112. package/src/lib/hooks/useSyncScroll.ts +31 -0
  113. package/src/lib/hooks/useWindowResize.ts +37 -0
  114. package/src/lib/index.tsx +14 -0
  115. package/src/lib/positionManger/context.ts +14 -0
  116. package/src/lib/positionManger/provider.tsx +113 -0
  117. package/src/lib/positionManger/usePosition.ts +8 -0
  118. package/src/lib/store/context.ts +5 -0
  119. package/src/lib/store/default.ts +157 -0
  120. package/src/lib/store/provider.tsx +211 -0
  121. package/src/lib/store/types.ts +33 -0
  122. package/src/lib/styles/styles.ts +256 -0
  123. package/src/lib/types.ts +423 -0
  124. package/src/lib/views/Day.tsx +265 -0
  125. package/src/lib/views/DayAgenda.tsx +57 -0
  126. package/src/lib/views/Editor.tsx +258 -0
  127. package/src/lib/views/Month.tsx +82 -0
  128. package/src/lib/views/MonthAgenda.tsx +84 -0
  129. package/src/lib/views/Week.tsx +92 -0
  130. package/src/lib/views/WeekAgenda.tsx +81 -0
  131. package/src/vite-env.d.ts +3 -0
  132. package/tsconfig.build.json +5 -0
  133. package/tsconfig.json +27 -0
  134. package/vite.config.js +40 -0
package/jest.config.ts ADDED
@@ -0,0 +1,194 @@
1
+ /*
2
+ * For a detailed explanation regarding each configuration property and type check, visit:
3
+ * https://jestjs.io/docs/configuration
4
+ */
5
+
6
+ export default {
7
+ // All imported modules in your tests should be mocked automatically
8
+ // automock: false,
9
+
10
+ // Stop running tests after `n` failures
11
+ // bail: 0,
12
+
13
+ // The directory where Jest should store its cached dependency information
14
+ // cacheDirectory: "/tmp/jest_rs",
15
+
16
+ // Automatically clear mock calls, instances and results before every test
17
+ // clearMocks: false,
18
+
19
+ // Indicates whether the coverage information should be collected while executing the test
20
+ // collectCoverage: false,
21
+
22
+ // An array of glob patterns indicating a set of files for which coverage information should be collected
23
+ // collectCoverageFrom: undefined,
24
+
25
+ // The directory where Jest should output its coverage files
26
+ // coverageDirectory: undefined,
27
+
28
+ // An array of regexp pattern strings used to skip coverage collection
29
+ // coveragePathIgnorePatterns: [
30
+ // "/node_modules/"
31
+ // ],
32
+
33
+ // Indicates which provider should be used to instrument code for coverage
34
+ // coverageProvider: "babel",
35
+
36
+ // A list of reporter names that Jest uses when writing coverage reports
37
+ // coverageReporters: [
38
+ // "json",
39
+ // "text",
40
+ // "lcov",
41
+ // "clover"
42
+ // ],
43
+
44
+ // An object that configures minimum threshold enforcement for coverage results
45
+ // coverageThreshold: undefined,
46
+
47
+ // A path to a custom dependency extractor
48
+ // dependencyExtractor: undefined,
49
+
50
+ // Make calling deprecated APIs throw helpful error messages
51
+ // errorOnDeprecated: false,
52
+
53
+ // Force coverage collection from ignored files using an array of glob patterns
54
+ // forceCoverageMatch: [],
55
+
56
+ // A path to a module which exports an async function that is triggered once before all test suites
57
+ // globalSetup: undefined,
58
+
59
+ // A path to a module which exports an async function that is triggered once after all test suites
60
+ // globalTeardown: undefined,
61
+
62
+ // A set of global variables that need to be available in all test environments
63
+ // globals: {},
64
+
65
+ // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
66
+ // maxWorkers: "50%",
67
+
68
+ // An array of directory names to be searched recursively up from the requiring module's location
69
+ // moduleDirectories: [
70
+ // "node_modules"
71
+ // ],
72
+
73
+ // An array of file extensions your modules use
74
+ // moduleFileExtensions: [
75
+ // "js",
76
+ // "jsx",
77
+ // "ts",
78
+ // "tsx",
79
+ // "json",
80
+ // "node"
81
+ // ],
82
+
83
+ // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
84
+ // moduleNameMapper: {},
85
+
86
+ // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
87
+ // modulePathIgnorePatterns: [],
88
+
89
+ // Activates notifications for test results
90
+ // notify: false,
91
+
92
+ // An enum that specifies notification mode. Requires { notify: true }
93
+ // notifyMode: "failure-change",
94
+
95
+ // A preset that is used as a base for Jest's configuration
96
+ // preset: undefined,
97
+
98
+ // Run tests from one or more projects
99
+ // projects: undefined,
100
+
101
+ // Use this configuration option to add custom reporters to Jest
102
+ // reporters: undefined,
103
+
104
+ // Automatically reset mock state before every test
105
+ // resetMocks: false,
106
+
107
+ // Reset the module registry before running each individual test
108
+ // resetModules: false,
109
+
110
+ // A path to a custom resolver
111
+ // resolver: undefined,
112
+
113
+ // Automatically restore mock state and implementation before every test
114
+ // restoreMocks: false,
115
+
116
+ // The root directory that Jest should scan for tests and modules within
117
+ // rootDir: undefined,
118
+
119
+ // A list of paths to directories that Jest should use to search for files in
120
+ roots: ["<rootDir>/src"],
121
+
122
+ // Allows you to use a custom runner instead of Jest's default test runner
123
+ // runner: "jest-runner",
124
+
125
+ // The paths to modules that run some code to configure or set up the testing environment before each test
126
+ // setupFiles: [],
127
+
128
+ // A list of paths to modules that run some code to configure or set up the testing framework before each test
129
+ // setupFilesAfterEnv: [],
130
+
131
+ // The number of seconds after which a test is considered as slow and reported as such in the results.
132
+ // slowTestThreshold: 5,
133
+
134
+ // A list of paths to snapshot serializer modules Jest should use for snapshot testing
135
+ // snapshotSerializers: [],
136
+
137
+ // The test environment that will be used for testing
138
+ testEnvironment: "jest-environment-jsdom",
139
+
140
+ // Options that will be passed to the testEnvironment
141
+ // testEnvironmentOptions: {},
142
+
143
+ // Adds a location field to test results
144
+ // testLocationInResults: false,
145
+
146
+ // The glob patterns Jest uses to detect test files
147
+ // testMatch: [
148
+ // "**/__tests__/**/*.[jt]s?(x)",
149
+ // "**/?(*.)+(spec|test).[tj]s?(x)"
150
+ // ],
151
+
152
+ // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
153
+ // testPathIgnorePatterns: [
154
+ // "/node_modules/"
155
+ // ],
156
+
157
+ // The regexp pattern or array of patterns that Jest uses to detect test files
158
+ // testRegex: [],
159
+
160
+ // This option allows the use of a custom results processor
161
+ // testResultsProcessor: undefined,
162
+
163
+ // This option allows use of a custom test runner
164
+ // testRunner: "jest-circus/runner",
165
+
166
+ // This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
167
+ // testURL: "http://localhost",
168
+
169
+ // Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
170
+ // timers: "real",
171
+
172
+ // A map from regular expressions to paths to transformers
173
+ transform: {
174
+ "^.+\\.(ts|js)x?$": "ts-jest",
175
+ },
176
+
177
+ // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
178
+ // transformIgnorePatterns: [
179
+ // "/node_modules/",
180
+ // "\\.pnp\\.[^\\/]+$"
181
+ // ],
182
+
183
+ // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
184
+ // unmockedModulePathPatterns: undefined,
185
+
186
+ // Indicates whether each individual test should be reported during the run
187
+ // verbose: undefined,
188
+
189
+ // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
190
+ // watchPathIgnorePatterns: [],
191
+
192
+ // Whether to use watchman for file crawling
193
+ // watchman: true,
194
+ };
package/package.json ADDED
@@ -0,0 +1,137 @@
1
+ {
2
+ "name": "@isma91/react-scheduler",
3
+ "version": "4.0.0",
4
+ "description": "React scheduler component based on Material-UI & date-fns",
5
+ "files": [
6
+ "*"
7
+ ],
8
+ "type": "module",
9
+ "scripts": {
10
+ "start": "vite serve",
11
+ "build": "vite build --mode production",
12
+ "postbuild": "node ./scripts/post-pack.js",
13
+ "local:pack": "npm run build && cd dist && npm pack && mv *.tgz ../",
14
+ "format": "prettier --check \"**/*.{js,jsx,ts,tsx,json}\"",
15
+ "format:write": "prettier --write \"**/*.{js,jsx,ts,tsx,json}\"",
16
+ "lint": "npm run types && eslint .",
17
+ "lint:fix": "eslint . --fix",
18
+ "types": "tsc --noEmit",
19
+ "prepare": "husky install",
20
+ "pre:commit": "lint-staged",
21
+ "test": "jest",
22
+ "test:watch": "jest --watch",
23
+ "test:ci": "jest --ci"
24
+ },
25
+ "exports": {
26
+ "./types": {
27
+ "import": "./types.d.ts"
28
+ },
29
+ ".": {
30
+ "import": "./index.js"
31
+ }
32
+ },
33
+ "lint-staged": {
34
+ "**/*.{ts,js,tsx,jsx}": [
35
+ "npm run lint"
36
+ ],
37
+ "**/*.{ts,js,tsx,jsx,json,yml}": [
38
+ "npm run format:write"
39
+ ]
40
+ },
41
+ "repository": {
42
+ "type": "git",
43
+ "url": "https://github.com/isma91/react-scheduler.git"
44
+ },
45
+ "author": "isma91 (fork of Aldabil)",
46
+ "bugs": {
47
+ "url": "https://github.com/isma91/react-scheduler/issues"
48
+ },
49
+ "keywords": [
50
+ "react",
51
+ "material-ui",
52
+ "calendar",
53
+ "scheduler"
54
+ ],
55
+ "license": "MIT",
56
+ "devDependencies": {
57
+ "@emotion/react": "^11.14.0",
58
+ "@emotion/styled": "^11.14.0",
59
+ "@eslint/compat": "^1.2.6",
60
+ "@eslint/eslintrc": "^3.2.0",
61
+ "@eslint/js": "^9.20.0",
62
+ "@mui/icons-material": ">=7.0.2",
63
+ "@mui/material": ">=7.0.2",
64
+ "@mui/x-date-pickers": ">=8.0.0",
65
+ "@testing-library/dom": "^10.4.0",
66
+ "@testing-library/jest-dom": "^6.6.3",
67
+ "@testing-library/react": "^16.2.0",
68
+ "@testing-library/user-event": "^14.6.1",
69
+ "@types/jest": "^29.5.14",
70
+ "@types/react": "^19.0.10",
71
+ "@types/react-dom": "^19.0.4",
72
+ "@types/rollup-plugin-peer-deps-external": "^2",
73
+ "@typescript-eslint/parser": "^8.24.1",
74
+ "@vitejs/plugin-react": "^4.3.4",
75
+ "date-fns": ">=4.1.0",
76
+ "eslint": "^9.20.1",
77
+ "eslint-import-resolver-typescript": "^3.8.3",
78
+ "eslint-plugin-import": "^2.31.0",
79
+ "eslint-plugin-jsx-a11y": "^6.10.2",
80
+ "eslint-plugin-promise": "^7.2.1",
81
+ "eslint-plugin-react": "^7.37.4",
82
+ "eslint-plugin-react-hooks": "^5.2.0",
83
+ "eslint-plugin-react-refresh": "^0.4.19",
84
+ "globals": "^16.0.0",
85
+ "husky": "^9.1.7",
86
+ "jest": "^29.7.0",
87
+ "jest-environment-jsdom": "^29.7.0",
88
+ "lint-staged": "^15.4.3",
89
+ "prettier": "^3.5.1",
90
+ "react": ">=19.0.0",
91
+ "react-dom": "^19.0.0",
92
+ "react-router-dom": "^7.3.0",
93
+ "rollup-plugin-peer-deps-external": "^2.2.4",
94
+ "rrule": "^2.8.1",
95
+ "ts-jest": "^29.2.5",
96
+ "ts-node": "^10.9.2",
97
+ "typescript": "^5.7.3",
98
+ "typescript-eslint": "^8.24.1",
99
+ "vite": "^6.1.1",
100
+ "vite-plugin-checker": "^0.9.0",
101
+ "vite-plugin-dts": "^4.5.0",
102
+ "vite-plugin-svgr": "^4.3.0",
103
+ "vite-tsconfig-paths": "^5.1.4"
104
+ },
105
+ "peerDependencies": {
106
+ "@mui/icons-material": ">=7.0.0",
107
+ "@mui/material": ">=7.0.0",
108
+ "@mui/x-date-pickers": ">=7.0.0",
109
+ "date-fns": ">=4.0.0",
110
+ "react": ">=18.0.0",
111
+ "react-dom": ">=18.0.0",
112
+ "rrule": ">=2.8.1"
113
+ },
114
+ "peerDependenciesMeta": {
115
+ "rrule": {
116
+ "optional": true
117
+ }
118
+ },
119
+ "eslintConfig": {
120
+ "extends": [
121
+ "react-app",
122
+ "react-app/jest"
123
+ ]
124
+ },
125
+ "browserslist": {
126
+ "production": [
127
+ ">0.2%",
128
+ "not dead",
129
+ "not op_mini all"
130
+ ],
131
+ "development": [
132
+ "last 1 chrome version",
133
+ "last 1 firefox version",
134
+ "last 1 safari version"
135
+ ]
136
+ }
137
+ }
Binary file
Binary file
Binary file
@@ -0,0 +1,25 @@
1
+ {
2
+ "short_name": "React App",
3
+ "name": "Create React App Sample",
4
+ "icons": [
5
+ {
6
+ "src": "favicon.ico",
7
+ "sizes": "64x64 32x32 24x24 16x16",
8
+ "type": "image/x-icon"
9
+ },
10
+ {
11
+ "src": "logo192.png",
12
+ "type": "image/png",
13
+ "sizes": "192x192"
14
+ },
15
+ {
16
+ "src": "logo512.png",
17
+ "type": "image/png",
18
+ "sizes": "512x512"
19
+ }
20
+ ],
21
+ "start_url": ".",
22
+ "display": "standalone",
23
+ "theme_color": "#000000",
24
+ "background_color": "#ffffff"
25
+ }
@@ -0,0 +1,3 @@
1
+ # https://www.robotstxt.org/robotstxt.html
2
+ User-agent: *
3
+ Disallow:
@@ -0,0 +1,34 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+
4
+ const init = async () => {
5
+ try {
6
+ const base = path.resolve("");
7
+ const files = ["LICENSE", "README.md"];
8
+ for (const file of files) {
9
+ await fs.promises.copyFile(path.join(base, file), path.join(base, "dist", file));
10
+ }
11
+
12
+ // clean up package.json on the fly
13
+ const pkg = await fs.promises.readFile(path.join(base, "package.json"), {
14
+ encoding: "utf-8",
15
+ });
16
+ const obj = JSON.parse(pkg);
17
+ delete obj.scripts;
18
+ delete obj.devDependencies;
19
+ delete obj["lint-staged"];
20
+ obj.homepage = "https://github.com/aldabil21/react-scheduler#readme";
21
+
22
+ await fs.promises.writeFile(
23
+ path.join(base, "dist", "package.json"),
24
+ JSON.stringify(obj, null, 2),
25
+ {
26
+ encoding: "utf-8",
27
+ }
28
+ );
29
+ } catch (error) {
30
+ throw error;
31
+ }
32
+ };
33
+
34
+ init();
package/src/App.tsx ADDED
@@ -0,0 +1,25 @@
1
+ import { Scheduler } from "./lib";
2
+ import { EVENTS } from "./events";
3
+ import { useRef } from "react";
4
+ import { SchedulerRef } from "./lib/types";
5
+ import { Link } from "react-router-dom";
6
+
7
+ function App() {
8
+ const calendarRef = useRef<SchedulerRef>(null);
9
+
10
+ return (
11
+ <>
12
+ <div>
13
+ <Link to="/1">Go to page 1</Link>
14
+ </div>
15
+
16
+ <Scheduler
17
+ ref={calendarRef}
18
+ events={EVENTS}
19
+ // events={generateRandomEvents(200)}
20
+ />
21
+ </>
22
+ );
23
+ }
24
+
25
+ export default App;
package/src/Page1.tsx ADDED
@@ -0,0 +1,67 @@
1
+ import { Scheduler } from "./lib";
2
+ import { EVENTS } from "./events";
3
+ import { useCallback, useRef, useState } from "react";
4
+ import { SchedulerRef } from "./lib/types";
5
+ import { Link } from "react-router-dom";
6
+ import { Button } from "@mui/material";
7
+
8
+ function Page1() {
9
+ const calendarRef = useRef<SchedulerRef>(null);
10
+ const [loading, setLoading] = useState(false);
11
+
12
+ const handleRefresh = () => {
13
+ setLoading(true);
14
+ setTimeout(() => {
15
+ setLoading(false);
16
+ }, 2000);
17
+ };
18
+
19
+ const customHeader = useCallback(
20
+ () => <Button onClick={handleRefresh}>{loading ? "LOADING..." : "Refresh"}</Button>,
21
+ [loading, handleRefresh]
22
+ );
23
+
24
+ return (
25
+ <>
26
+ <div style={{ height: "200vh" }}>
27
+ <div>
28
+ <Link to="/">Go to home</Link>
29
+ <button onClick={() => setLoading((prev) => !prev)}>
30
+ Toggle Loading ({loading ? "ON" : "OFF"})
31
+ </button>
32
+ </div>
33
+
34
+ <div style={{ marginTop: "50px" }}>
35
+ <Scheduler
36
+ day={{
37
+ startHour: 0,
38
+ endHour: 24,
39
+ step: 60,
40
+ navigation: true,
41
+ }}
42
+ week={{
43
+ weekDays: [0, 1, 2, 3, 4, 5, 6],
44
+ weekStartOn: 1,
45
+ startHour: 0,
46
+ endHour: 24,
47
+ step: 60,
48
+ navigation: true,
49
+ disableGoToDay: true,
50
+ }}
51
+ ref={calendarRef}
52
+ events={EVENTS}
53
+ loading={loading}
54
+ customHeaderContent={customHeader}
55
+ stickyNavigation={true}
56
+ stickyNavigationOffset={64}
57
+ currentTimeBarColor="#ff00c3ff"
58
+ forceInlineMultiDay={true}
59
+ // events={generateRandomEvents(200)}
60
+ />
61
+ </div>
62
+ </div>
63
+ </>
64
+ );
65
+ }
66
+
67
+ export default Page1;