-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
74bb9f2
commit 755b224
Showing
25 changed files
with
332 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import * as React from "react"; | ||
|
||
import { Image, AppImage } from "atoms/styled"; | ||
import useAnimationEndRender from "utils/hooks/useAnimationEndRender"; | ||
|
||
interface IProps { | ||
path: string; | ||
instanceId?: string; | ||
} | ||
|
||
const PhotoIcon = ({ path, instanceId }: IProps) => { | ||
const { render } = useAnimationEndRender({ instanceId }); | ||
|
||
return render ? ( | ||
<Image | ||
height={64} | ||
style={{ padding: "4px 0" }} | ||
src={require(`apps/photo/assests/${path}`).default} | ||
/> | ||
) : ( | ||
<AppImage size={64} name="photo"></AppImage> | ||
); | ||
}; | ||
|
||
export default React.memo(PhotoIcon); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import * as React from "react"; | ||
import AppShell from "apps/shell"; | ||
import styled from "styled-components"; | ||
|
||
import { Image, Stack, Text } from "atoms/styled"; | ||
import useAnimationEndRender from "utils/hooks/useAnimationEndRender"; | ||
|
||
const Wrapper = styled(Stack)` | ||
background: ${({ theme }) => theme.colors.plain}; | ||
`; | ||
|
||
interface IProps { | ||
path: string; | ||
instanceId: string; | ||
appName: string; | ||
onMouseDown: (event: React.MouseEvent) => void; | ||
} | ||
|
||
const Photo = ({ path, appName, instanceId, onMouseDown }: IProps) => { | ||
const { render } = useAnimationEndRender({ instanceId }); | ||
|
||
return ( | ||
<AppShell | ||
onMouseDown={onMouseDown} | ||
appName={appName} | ||
instanceId={instanceId} | ||
icon="photo" | ||
name="Photo" | ||
> | ||
<Wrapper fullHeight fullWidth alignItems="center" justifyContent="center"> | ||
{render ? ( | ||
<Image | ||
style={{ maxHeight: "100%" }} | ||
src={require(`apps/photo/assests/${path}`).default} | ||
/> | ||
) : ( | ||
<Text textAlign="center">Loading Image...</Text> | ||
)} | ||
</Wrapper> | ||
</AppShell> | ||
); | ||
}; | ||
|
||
export default React.memo(Photo); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import styled from "styled-components"; | ||
import * as React from "react"; | ||
|
||
import { Acrylic, Stack, Text, Icon, StackItem } from "atoms/styled"; | ||
import AppImage from "atoms/styled/appImage"; | ||
|
||
const Wrapper = styled(Acrylic)` | ||
width: 720px; | ||
min-width: 240px; | ||
min-height: 240px; | ||
height: 480px; | ||
border-radius: ${({ theme }) => theme.borderRadius}px; | ||
resize: both; | ||
overflow: auto; | ||
`; | ||
|
||
const TopBar = styled.div` | ||
height: 38px; | ||
padding: 0 16px; | ||
`; | ||
|
||
const Content = styled.div` | ||
height: 100%; | ||
width: 100%; | ||
`; | ||
|
||
type IProps = ReactHTMLElement< | ||
"div", | ||
{ | ||
icon: string; | ||
name: string; | ||
appName: string; | ||
instanceId: string; | ||
children: React.ReactChild; | ||
} | ||
>; | ||
|
||
const AppShell = ({ | ||
icon, | ||
name, | ||
appName, | ||
instanceId, | ||
children, | ||
onMouseDown, | ||
ref, | ||
...rest | ||
}: IProps) => { | ||
return ( | ||
<Wrapper | ||
{...rest} | ||
data-id="app-shell-wrapper" | ||
onMouseDown={() => { | ||
window.os.bringToTop({ appName, instanceId }); | ||
}} | ||
> | ||
<Stack fullWidth fullHeight flexDirection="column"> | ||
<StackItem flexShrink={0} data-test="topbar"> | ||
<TopBar data-id="app-shell-top-bar" onMouseDown={onMouseDown}> | ||
<Stack | ||
alignItems="center" | ||
justifyContent="space-between" | ||
fullHeight | ||
> | ||
<Stack alignItems="center"> | ||
<AppImage height={24} name={icon} style={{ paddingRight: 8 }} /> | ||
<Text weight={700} variant="mediumPlus"> | ||
{name} | ||
</Text> | ||
</Stack> | ||
<Stack> | ||
<Icon | ||
onClick={() => window.os.closeApp({ appName, instanceId })} | ||
size={12} | ||
iconName="ChromeClose" | ||
cursor="pointer" | ||
/> | ||
</Stack> | ||
</Stack> | ||
</TopBar> | ||
</StackItem> | ||
<StackItem flexGrow={2} style={{ overflow: "hidden" }}> | ||
<Content | ||
onMouseDown={(e) => e.stopPropagation()} | ||
data-id="app-shell-content" | ||
> | ||
{children} | ||
</Content> | ||
</StackItem> | ||
</Stack> | ||
</Wrapper> | ||
); | ||
}; | ||
|
||
export default AppShell; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import * as React from "react"; | ||
|
||
import PhotoIcon from "apps/photo/icon"; | ||
|
||
const map = { | ||
photo: PhotoIcon, | ||
}; | ||
|
||
interface IProps { | ||
data: Record<string, any>; | ||
appName: "photo"; | ||
// folder instance id | ||
instanceId?: string; | ||
} | ||
|
||
const CustomIcon = ({ data, appName, instanceId }: IProps) => { | ||
const AppIcon = map[appName]; | ||
// pass everything from the data let the icon decide | ||
return <AppIcon {...(data as any)} instanceId={instanceId} />; | ||
}; | ||
|
||
export default CustomIcon; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.