Skip to content

Commit 6fb1ec2

Browse files
committed
#develop add GitHub widget window to web app
1 parent 9d6feb3 commit 6fb1ec2

6 files changed

Lines changed: 55 additions & 4 deletions

File tree

apps/web/src/app/components/WindowCanvas.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { TrashDropZone, type WindowCx } from '@/features/window';
44
import { ActivityWindow } from '../windows/activity';
55
import { CatWindow } from '../windows/cat';
66
import { DiscordWindow } from '../windows/discord';
7+
import { GithubWindow } from '../windows/github';
78
import { MacosWindow } from '../windows/macos';
89
import { MainWindow } from '../windows/main';
910
import { SettingsWindow } from '../windows/settings';
@@ -88,10 +89,20 @@ export const WindowCanvas: React.FC<TWindowCanvasProps> = (props) => {
8889
>
8990
<MacosWindow />
9091
</DraggableWindow>
92+
<DraggableWindow
93+
windowId="github"
94+
windowCx={windowCx}
95+
transparent
96+
dragThreshold={8}
97+
excludeFromDrag=""
98+
className="active:cursor-grabbing"
99+
>
100+
<GithubWindow />
101+
</DraggableWindow>
91102
</>
92103
)}
93104

94-
<TrashDropZone windowCx={windowCx} trashableIds={['spotify', 'discord', 'macos']} />
105+
<TrashDropZone windowCx={windowCx} trashableIds={['spotify', 'discord', 'macos', 'github']} />
95106
</>
96107
);
97108
};

apps/web/src/app/windows/discord/DiscordWindow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const DiscordWindow: React.FC = () => {
1010
target="_blank"
1111
rel="noopener noreferrer"
1212
draggable={false}
13-
className="flex min-w-0 flex-1 items-center justify-center rounded-xl bg-[#E0E3FF] p-3 transition hover:opacity-90"
13+
className="flex min-w-0 flex-1 items-center justify-center rounded-xl bg-[#E0E3FF] transition hover:opacity-90"
1414
>
1515
<DiscordWordmarkLogo className="h-5 w-auto text-[#5865F2]" aria-hidden />
1616
</a>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import React from 'react';
2+
import { GithubIcon } from '@/components/display/icons';
3+
import { appConfig } from '@/environment';
4+
5+
export const GithubWindow: React.FC = () => {
6+
return (
7+
<div data-drag-region className="group flex h-full w-full overflow-hidden rounded-xl shadow-lg">
8+
<a
9+
href={appConfig.distribution.github}
10+
target="_blank"
11+
rel="noopener noreferrer"
12+
draggable={false}
13+
className="bg-base-0 text-base-900 flex min-w-0 flex-1 items-center justify-center rounded-xl transition hover:opacity-90"
14+
>
15+
<GithubIcon className="h-7 w-auto" aria-hidden />
16+
</a>
17+
</div>
18+
);
19+
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './GithubWindow';

apps/web/src/app/windows/macos/MacosWindow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const MacosWindow: React.FC = () => {
1010
target="_blank"
1111
rel="noopener noreferrer"
1212
draggable={false}
13-
className="bg-base-0 flex min-w-0 flex-1 items-center justify-center rounded-xl p-3 transition hover:opacity-90"
13+
className="bg-base-0 flex min-w-0 flex-1 items-center justify-center rounded-xl transition hover:opacity-90"
1414
>
1515
<AppleIcon className="text-base-900 h-6 w-auto" aria-hidden />
1616
</a>

apps/web/src/features/window/WindowCx.tsx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,18 @@ export class WindowCx {
7676
boundsBeforeMaximize: null,
7777
canMaximize: false
7878
},
79+
github: {
80+
id: 'github',
81+
trafficLights: { close: false, minimize: false, maximize: false },
82+
bounds: {
83+
size: { width: 48, height: 48 },
84+
position: { x: 'start', y: 'end', offset: { x: 8 + 172 + 8 + 48 + 8, y: 8 + 152 + 8 } }
85+
},
86+
visibility: 'visible',
87+
zIndex: 10,
88+
boundsBeforeMaximize: null,
89+
canMaximize: false
90+
},
7991
spotify: {
8092
id: 'spotify',
8193
trafficLights: { close: false, minimize: false, maximize: false },
@@ -339,7 +351,15 @@ export interface TWindowConfig extends TWindow {
339351
canMaximize: boolean;
340352
}
341353

342-
export type TWindowId = 'main' | 'settings' | 'activity' | 'cat' | 'discord' | 'macos' | 'spotify';
354+
export type TWindowId =
355+
| 'main'
356+
| 'settings'
357+
| 'activity'
358+
| 'cat'
359+
| 'discord'
360+
| 'macos'
361+
| 'spotify'
362+
| 'github';
343363
export type TWindowVisibility = 'visible' | 'minimized' | 'closed';
344364

345365
export interface TBounds {

0 commit comments

Comments
 (0)