Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add calendar app #63

Merged
merged 4 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
"i18next-browser-languagedetector": "^7.2.1",
"immer": "^10.0.4",
"lodash": "^4.17.21",
"moment": "^2.30.1",
"react": "^18.3.1",
"react-beautiful-dnd": "^13.1.1",
"react-big-calendar": "^1.13.0",
"react-dom": "^18.3.1",
"react-draggable": "^4.4.6",
"react-full-screen": "^1.1.1",
Expand Down Expand Up @@ -85,6 +87,7 @@
"@types/draft-js": "^0.11.18",
"@types/jest": "^29.5.12",
"@types/react-beautiful-dnd": "^13.1.8",
"@types/react-big-calendar": "^1.8.9",
"@types/react-resizable": "^3.0.7",
"@types/react-test-renderer": "^18.3.0",
"babel-jest": "^29.7.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { lazy } from 'react';
import { LazyProvider } from '../../../component';

const Calendar = lazy(
() => import('../../../../../screens/private/program/Calendar/Calendar'),
);

const LazyCalendarComponent = () => {
return (
<LazyProvider>
<Calendar />
</LazyProvider>
);
};

export { LazyCalendarComponent };
3 changes: 3 additions & 0 deletions src/router/lazyRouting/lazy_screen/private/program/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ export * from './LazySettingsScreen';
export * from './LazySpotifyScreen';
export * from './LazyTerminalScreen';
export * from './LazyVsCodeScreen';

// Other apps
export * from './LazyCalendarScreen';
3 changes: 2 additions & 1 deletion src/screens/private/Home/AppMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
LazyTerminalComponent,
LazyVsCodeComponent,
LazyBinComponent,
LazyCalendarComponent,
} from '@router';

const WindowAppMap: Record<ProgramType, JSX.Element | undefined> = {
Expand All @@ -26,7 +27,7 @@ const WindowAppMap: Record<ProgramType, JSX.Element | undefined> = {
[ProgramType.SAFARI]: undefined,
[ProgramType.MAILS]: undefined,
[ProgramType.CONTACTS]: undefined,
[ProgramType.CALENDAR]: undefined,
[ProgramType.CALENDAR]: <LazyCalendarComponent />,
[ProgramType.REMINDERS]: undefined,
[ProgramType.FACE_TIME]: undefined,
[ProgramType.MESSAGES]: undefined,
Expand Down
15 changes: 2 additions & 13 deletions src/screens/private/Home/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
import { createContext, useContext } from 'react';
import { Box, useBoolean } from '@chakra-ui/react';
import { useContext } from 'react';
import { Box } from '@chakra-ui/react';
import { HomeProps } from './type';
import { WallpaperComponent, Window } from '@components';
import { settingsStore, useShallow, wallpaperSelector } from '@settingsStore';
import { TopBar } from './TopBar';
import {
LazyBinComponent,
LazyChromeComponent,
LazyFinderComponent,
LazyGithubComponent,
LazyNotesComponent,
LazySettingsComponent,
LazySpotifyComponent,
LazyTerminalComponent,
LazyVsCodeComponent,
} from '@router';
import { BottomBar } from './BottomBar';
import {
ProgramType,
Expand Down
20 changes: 20 additions & 0 deletions src/screens/private/Home/__tests__/Home.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,26 @@ describe('Home', () => {
});
});

it('should render correctly with calendar app to match snapshot', () => {
renderHook(() => settingsStore());
renderHook(() => uiStore());
renderHook(() => appStore());
const { result } = renderHook(() => processStore());

act(() => {
result.current.ActiveApp.addApp(ProgramType.CALENDAR);
});

const { container } = render(<Home />);

expect(container).toMatchSnapshot();

// cleanup
act(() => {
result.current.ActiveApp.removeApp(ProgramType.CALENDAR);
});
});

it('should render correctly with chrome app to match snapshot', () => {
renderHook(() => settingsStore());
renderHook(() => uiStore());
Expand Down
Loading
Loading