-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move encode page into library segment
- Loading branch information
1 parent
0057e45
commit 4ab28b5
Showing
9 changed files
with
140 additions
and
128 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
app/src/app/(libraries)/library/[slug]/encode/[id]/layout.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,9 @@ | ||
import { LayoutNarrow } from '@/components/layouts' | ||
|
||
type LibraryEncodeLayoutProps = React.PropsWithChildren | ||
|
||
const LibraryEncodeLayout: React.FC<LibraryEncodeLayoutProps> = ({ children }) => ( | ||
<LayoutNarrow>{children}</LayoutNarrow> | ||
) | ||
|
||
export default LibraryEncodeLayout |
113 changes: 113 additions & 0 deletions
113
app/src/app/(libraries)/library/[slug]/encode/[id]/page.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,113 @@ | ||
'use client' | ||
|
||
import type { page_EncodedPage_Query } from '@/__generated__/page_EncodedPage_Query.graphql' | ||
|
||
import { Alert, Card, Typography } from '@giantnodes/react' | ||
import { IconAlertCircleFilled } from '@tabler/icons-react' | ||
import { notFound } from 'next/navigation' | ||
import { graphql, useLazyLoadQuery } from 'react-relay' | ||
|
||
import { | ||
EncodeCommandWidget, | ||
EncodeOperationWidget, | ||
EncodeOutputWidget, | ||
EncodeSizeWidget, | ||
} from '@/components/interfaces/encode' | ||
import { FileSystemBreadcrumb } from '@/components/interfaces/file-system' | ||
|
||
const QUERY = graphql` | ||
query page_EncodedPage_Query($where: EncodeFilterInput) { | ||
encode(where: $where) { | ||
failure_reason | ||
file { | ||
...FileSystemBreadcrumbFragment | ||
} | ||
...EncodeOperationWidgetFragment | ||
...EncodeCommandWidgetFragment | ||
...EncodeOutputWidgetFragment | ||
...EncodeSizeWidgetFragment | ||
} | ||
} | ||
` | ||
|
||
type EncodePageProps = { | ||
params: { | ||
[x: string]: never | ||
} | ||
} | ||
|
||
const EncodePage: React.FC<EncodePageProps> = ({ params }) => { | ||
const query = useLazyLoadQuery<page_EncodedPage_Query>(QUERY, { | ||
where: { | ||
id: { | ||
eq: decodeURIComponent(params.id), | ||
}, | ||
}, | ||
}) | ||
|
||
if (query.encode == null) { | ||
return notFound() | ||
} | ||
|
||
return ( | ||
<div className="flex flex-col lg:flex-row gap-3"> | ||
<div className="flex flex-col grow gap-3"> | ||
{query.encode.failure_reason && ( | ||
<Alert color="danger"> | ||
<IconAlertCircleFilled size={16} /> | ||
<Alert.Body> | ||
<Alert.Heading>The encode operation encountered an error</Alert.Heading> | ||
<Alert.List> | ||
<Alert.Item>{query.encode.failure_reason}</Alert.Item> | ||
</Alert.List> | ||
</Alert.Body> | ||
</Alert> | ||
)} | ||
|
||
<Card> | ||
<Card.Body> | ||
<FileSystemBreadcrumb $key={query.encode.file} /> | ||
</Card.Body> | ||
</Card> | ||
|
||
<Card> | ||
<Card.Header> | ||
<Typography.Text>Size</Typography.Text> | ||
</Card.Header> | ||
|
||
<Card.Body className="h-56"> | ||
<EncodeSizeWidget $key={query.encode} /> | ||
</Card.Body> | ||
</Card> | ||
|
||
<Card> | ||
<Card.Header> | ||
<Typography.Text>Command</Typography.Text> | ||
</Card.Header> | ||
|
||
<Card.Body> | ||
<EncodeCommandWidget $key={query.encode} /> | ||
</Card.Body> | ||
</Card> | ||
|
||
<Card> | ||
<Card.Header> | ||
<Typography.Text>Output</Typography.Text> | ||
</Card.Header> | ||
|
||
<Card.Body> | ||
<EncodeOutputWidget $key={query.encode} /> | ||
</Card.Body> | ||
</Card> | ||
</div> | ||
|
||
<div className="flex flex-col gap-3 min-w-80"> | ||
<Card> | ||
<EncodeOperationWidget $key={query.encode} /> | ||
</Card> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default EncodePage |
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,3 @@ | ||
const DialogDefault: React.FC = () => null | ||
|
||
export default DialogDefault |
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