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

Port Next.js application to existing project #5

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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 web-segmentation-gallery/src/app/demo/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import DemoPageWrapper from '../../routes/DemoPageWrapper';

export default DemoPageWrapper;
21 changes: 0 additions & 21 deletions web-segmentation-gallery/src/app/globals.css

This file was deleted.

35 changes: 0 additions & 35 deletions web-segmentation-gallery/src/app/layout.tsx

This file was deleted.

101 changes: 0 additions & 101 deletions web-segmentation-gallery/src/app/page.tsx

This file was deleted.

18 changes: 5 additions & 13 deletions web-segmentation-gallery/src/layouts/RootLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@
* limitations under the License.
*/
import LoadingStateScreen from '@/common/loading/LoadingStateScreen';
import useSettingsContext from '@/settings/useSettingsContext';
import {Cog6ToothIcon} from '@heroicons/react/24/outline';
import stylex from '@stylexjs/stylex';
import {Suspense} from 'react';
import {Button, Indicator} from 'react-daisyui';
import {Outlet} from 'react-router-dom';
import { useRouter } from 'next/router';

const styles = stylex.create({
container: {
Expand Down Expand Up @@ -51,8 +50,8 @@ const styles = stylex.create({
},
});

export default function RootLayout() {
const {openModal, hasChanged} = useSettingsContext();
export default function RootLayout({ children }) {
const router = useRouter();

return (
<div {...stylex.props(styles.container)}>
Expand All @@ -64,21 +63,14 @@ export default function RootLayout() {
description="This may take a few moments, you're almost there!"
/>
}>
<Outlet />
{children}
</Suspense>
</div>
<div {...stylex.props(styles.debugActions)}>
<Indicator>
{hasChanged && (
<Indicator.Item
className="badge badge-primary scale-50"
horizontal="start"
vertical="top"
/>
)}
<Button
color="ghost"
onClick={openModal}
onClick={() => router.push('/settings')}
shape="circle"
size="xs"
startIcon={<Cog6ToothIcon className="w-4 h-4" />}
Expand Down
2 changes: 2 additions & 0 deletions web-segmentation-gallery/src/routes/DemoPageWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import LoadingStateScreen from '@/common/loading/LoadingStateScreen';
import DemoPage from '@/routes/DemoPage';
import stylex from '@stylexjs/stylex';
import {isFirefox} from 'react-device-detect';
import { useRouter } from 'next/router';

const styles = stylex.create({
link: {
Expand Down Expand Up @@ -47,6 +48,7 @@ function isBrowserSupported() {

export default function DemoPageWrapper() {
const isBrowserUnsupported = !isBrowserSupported();
const router = useRouter();

if (isBrowserUnsupported && isFirefox) {
const nightlyUrl = 'https://wiki.mozilla.org/Nightly';
Expand Down