-
Notifications
You must be signed in to change notification settings - Fork 88
Example project redesign #1
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,84 @@ | ||
| "use client"; | ||
|
|
||
| import { Fragment, useEffect } from "react"; | ||
| import { useMockService } from "@/data/MockData/useMockService"; | ||
| import { DocumentWidget } from "@/app/document-widget"; | ||
| import Link from "next/link"; | ||
| import { notFound } from "next/navigation"; | ||
|
|
||
| export type EntryPageParams = { | ||
| id: string; | ||
| }; | ||
| export default function EntryPage({ | ||
| params: { id }, | ||
| }: { | ||
| params: EntryPageParams; | ||
| }) { | ||
| const mockService = useMockService(); | ||
|
|
||
| if (!mockService) { | ||
| return null; | ||
| } | ||
|
|
||
| const entry = mockService.getEntryById(id); | ||
|
|
||
| if (!entry) { | ||
| notFound(); | ||
| } | ||
|
|
||
| return ( | ||
| <Fragment> | ||
| <div className={"container mx-auto"}> | ||
| <Link | ||
| href={"/entries"} | ||
| className={"underline text-blue-500 hover:opacity-70"} | ||
| > | ||
| ← All Entries | ||
| </Link> | ||
| <h2 className={"text-2xl mb-16 mt-4"}>{entry.name}</h2> | ||
|
|
||
| <div className={"mb-6"}> | ||
| <div className={"font-bold"}>ID</div> | ||
| <div>{entry.id}</div> | ||
| </div> | ||
|
|
||
| <div className={"mb-6"}> | ||
| <div className={"font-bold"}>Name</div> | ||
| <div>{entry.name}</div> | ||
| </div> | ||
|
|
||
| <div className={"mb-6"}> | ||
| <div className={"font-bold"}>Description</div> | ||
| <div>{entry.description}</div> | ||
| </div> | ||
|
|
||
| <div className={"mb-6"}> | ||
| <div className={"font-bold"}>Last modified</div> | ||
| <div>{entry.updatedAt.toString()}</div> | ||
| </div> | ||
|
|
||
| <div className={"mb-6"}> | ||
| <div className={"font-bold"}>Created at</div> | ||
| <div>{entry.createdAt.toString()}</div> | ||
| </div> | ||
|
|
||
| <div className={"mb-6"}> | ||
| <div className={"font-bold"}>Page</div> | ||
| <div className={"mt-3"}> | ||
| <DocumentWidget | ||
| document={entry.page} | ||
| onSave={(document) => { | ||
| mockService.updateEntry({ | ||
| ...entry, | ||
| page: document, | ||
| }); | ||
| }} | ||
| /> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </Fragment> | ||
| ); | ||
| } | ||
|
|
||
| export const revalidate = 0; |
This file contains hidden or 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,55 @@ | ||
| "use client"; | ||
|
|
||
| import { Fragment, useEffect } from "react"; | ||
| import { useMockService } from "@/data/MockData/useMockService"; | ||
| import Link from "next/link"; | ||
|
|
||
| export default function EntriesPage() { | ||
| const service = useMockService(); | ||
|
|
||
| if (!service) { | ||
| return null; | ||
| } | ||
|
|
||
| const entries = service.getEntries(); | ||
|
|
||
| const cellClasses = "p-2 text-left border border-gray-200 leading-none"; | ||
|
|
||
| return ( | ||
| <Fragment> | ||
| <div className={"container mx-auto"}> | ||
| <h2 className={"text-2xl mb-16"}>System entries</h2> | ||
|
|
||
| <table className={"border-collapse border border-gray-200 w-full"}> | ||
| <thead> | ||
| <tr> | ||
| <th className={cellClasses}>Name</th> | ||
| <th className={cellClasses}>Id</th> | ||
| <th className={cellClasses}>Last modified</th> | ||
| </tr> | ||
| </thead> | ||
| <tbody> | ||
| {entries.map((entry) => ( | ||
| <tr key={entry.id}> | ||
| <td className={cellClasses}> | ||
| <Link | ||
| href={`/entries/${entry.id}`} | ||
| className={"underline text-blue-500 hover:opacity-70"} | ||
| > | ||
| {entry.name} | ||
| </Link> | ||
| </td> | ||
| <td className={cellClasses}>{entry.id}</td> | ||
| <td className={cellClasses}> | ||
| {entry.updatedAt.toDateString()} | ||
| </td> | ||
| </tr> | ||
| ))} | ||
| </tbody> | ||
| </table> | ||
| </div> | ||
| </Fragment> | ||
| ); | ||
| } | ||
|
|
||
| export const revalidate = 0; |
This file contains hidden or 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,38 @@ | ||
| import "../globals.css"; | ||
| import type { Metadata } from "next"; | ||
| import { Inter } from "next/font/google"; | ||
|
|
||
| const inter = Inter({ subsets: ["latin"] }); | ||
|
|
||
| export const metadata: Metadata = { | ||
| title: "ACME Software", | ||
| description: "ACME Software using Easyblocks", | ||
| }; | ||
|
|
||
| export default function RootLayout({ | ||
| children, | ||
| }: { | ||
| children: React.ReactNode; | ||
| }) { | ||
| return ( | ||
| <html lang="en"> | ||
| <body className={inter.className}> | ||
| <div className={"border-b border-gray-300"}> | ||
| <header className="container mx-auto"> | ||
| <div className="flex justify-between items-center py-4"> | ||
| <div> | ||
| <a className="text-lg leading-none font-medium"> | ||
| ACME Company Software | ||
| </a> | ||
| </div> | ||
| <div className="text-right leading-none"> | ||
| John Doe - john.doe@acme.com | ||
| </div> | ||
| </div> | ||
| </header> | ||
| </div> | ||
| <main className="container mx-auto mt-16">{children}</main> | ||
| </body> | ||
| </html> | ||
| ); | ||
| } |
This file contains hidden or 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 Link from "next/link"; | ||
|
|
||
| export default function NotFound() { | ||
| return ( | ||
| <div> | ||
| <p>Could not find requested resource</p> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or 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,16 @@ | ||
| import Link from "next/link"; | ||
|
|
||
| export default function MainPage() { | ||
| return ( | ||
| <div className={"container mx-auto"}> | ||
| <h2 className={"text-2xl mb-16"}>Hello</h2> | ||
|
|
||
| <Link | ||
| href={`/entries`} | ||
| className={"underline text-blue-500 hover:opacity-70"} | ||
| > | ||
| System entries | ||
| </Link> | ||
| </div> | ||
| ); | ||
| } |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why removed it? I've added it to know what variables we have to set :)