Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
inetol committed Aug 10, 2024
1 parent 508542c commit f65e3b6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
10 changes: 8 additions & 2 deletions src/app/[documentName]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { EditorScreen } from '@/screen/EditorScreen';

export default function () {
return <EditorScreen enableEdit />;
type PageProps = {
params: {
documentName: string;
};
};

export default function (props: PageProps) {
return <EditorScreen documentName={props.params.documentName} enableEdit />;
}
4 changes: 2 additions & 2 deletions src/app/[documentName]/raw/page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { redirect } from 'next/navigation';

type RedirectProps = {
type PageProps = {
params: {
documentName: string;
};
};

export default function (props: RedirectProps) {
export default function (props: PageProps) {
// TODO: Expose Backend API route location
return redirect(`/api/document/${props.params.documentName}/raw`);
}
2 changes: 1 addition & 1 deletion src/component/editor/FooterComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const FooterComponent = (props: ControlsProps) => {
icon={<MdSubject fontSize='20px' />}
label='View Raw'
onClick={() => handleNavigation(`/documents/${props.documentName}/raw`)}
isDisabled={Boolean(props.documentName) || props.isEditing}
isDisabled={!props.documentName || props.isEditing}
/>
</Flex>
);
Expand Down
4 changes: 1 addition & 3 deletions src/screen/EditorScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ export const EditorScreen = ({ documentName, enableEdit = false }: EditorScreenP

return (
<div className='flex flex-col h-lvh'>
<header>
<HeaderComponent lineNumber={position.lineNumber} columnNumber={position.columnNumber} />
</header>
<HeaderComponent lineNumber={position.lineNumber} columnNumber={position.columnNumber} />
<EditorComponent
setCursorLocation={setPosition}
setValue={setValue}
Expand Down

0 comments on commit f65e3b6

Please sign in to comment.