-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔨 Switch Live to use useOvermind (#3558)
- Loading branch information
1 parent
32b350f
commit 40d7518
Showing
7 changed files
with
177 additions
and
182 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 was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
packages/app/src/app/pages/Live/Error/RoomNotFoundError.tsx
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,20 @@ | ||
import { Button, Text } from '@codesandbox/components'; | ||
import css from '@styled-system/css'; | ||
import React, { FunctionComponent } from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
export const RoomNotFoundError: FunctionComponent = () => ( | ||
<> | ||
<Text size={6} weight="bold"> | ||
Something went wrong | ||
</Text> | ||
|
||
<Text block marginTop={4} size={4}> | ||
{`It seems like this session doesn't exist or has been closed`} | ||
</Text> | ||
|
||
<Link css={css({ textDecoration: 'none' })} to="/s"> | ||
<Button marginTop={5}>Create Sandbox</Button> | ||
</Link> | ||
</> | ||
); |
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,36 @@ | ||
import { Button, Text } from '@codesandbox/components'; | ||
import css from '@styled-system/css'; | ||
import React, { FunctionComponent } from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
import { useOvermind } from 'app/overmind'; | ||
|
||
import { RoomNotFoundError } from './RoomNotFoundError'; | ||
|
||
export const Error: FunctionComponent = () => { | ||
const { | ||
state: { | ||
live: { error }, | ||
}, | ||
} = useOvermind(); | ||
|
||
if (error === 'room not found') { | ||
return <RoomNotFoundError />; | ||
} | ||
|
||
return ( | ||
<> | ||
<Text size={6} weight="bold"> | ||
An error occurred while connecting to the live session: | ||
</Text> | ||
|
||
<Text block marginTop={4} size={4}> | ||
{error} | ||
</Text> | ||
|
||
<Link css={css({ textDecoration: 'none' })} to="/s"> | ||
<Button marginTop={5}>Create Sandbox</Button> | ||
</Link> | ||
</> | ||
); | ||
}; |
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,34 @@ | ||
import { Button, Element, Stack, Text } from '@codesandbox/components'; | ||
import React, { FunctionComponent } from 'react'; | ||
import { useParams } from 'react-router-dom'; | ||
|
||
import { useOvermind } from 'app/overmind'; | ||
|
||
export const NotAuthenticated: FunctionComponent = () => { | ||
const { | ||
actions: { | ||
live: { signInToRoom }, | ||
}, | ||
} = useOvermind(); | ||
const { roomId } = useParams(); | ||
|
||
return ( | ||
<> | ||
<Text weight="bold" size={6}> | ||
Sign in required | ||
</Text> | ||
|
||
<Text block marginTop={4} size={4}> | ||
You need to sign in to join this session | ||
</Text> | ||
|
||
<Element marginTop={4}> | ||
<Button onClick={() => signInToRoom(roomId)} autoWidth> | ||
<Stack align="center" gap={2}> | ||
<Text style={{ lineHeight: 1 }}>Sign in</Text> | ||
</Stack> | ||
</Button> | ||
</Element> | ||
</> | ||
); | ||
}; |
Oops, something went wrong.