-
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.
- Loading branch information
1 parent
9d2f108
commit 076cc09
Showing
18 changed files
with
328 additions
and
111 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
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 |
---|---|---|
@@ -1,5 +1,13 @@ | ||
import FileExplorer from "@/components/file-explorer"; | ||
|
||
export default function LeftTop() { | ||
return <FileExplorer />; | ||
return ( | ||
<> | ||
<div className="p-4"> | ||
<h1 className="text-2xl">Welcome to AElf Playground.</h1> | ||
<p> | ||
To begin, click on the New button on the top menu and choose a | ||
template. | ||
</p> | ||
</div> | ||
</> | ||
); | ||
} |
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,19 @@ | ||
import FileExplorer from "@/components/file-explorer"; | ||
import { getTemplateData } from "@/data/template"; | ||
|
||
export default async function Page({ | ||
params: { id }, | ||
}: { | ||
params: { id: string }; | ||
}) { | ||
const data = await getTemplateData(id); | ||
|
||
return ( | ||
<> | ||
<FileExplorer | ||
paths={Object.keys(data).sort((a, b) => a.localeCompare(b))} | ||
pathname={`/template/${id}`} | ||
/> | ||
</> | ||
); | ||
} |
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,5 @@ | ||
import Editor from "@/components/editor"; | ||
|
||
export default function Top() { | ||
return <Editor />; | ||
} |
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,17 @@ | ||
import Editor from "@/components/editor"; | ||
import { getLang } from "@/components/editor-enum"; | ||
import { getTemplateData } from "@/data/template"; | ||
import { strFromU8 } from "fflate"; | ||
|
||
export default async function Page({ | ||
params: { id, file }, | ||
}: { | ||
params: { id: string; file: string }; | ||
}) { | ||
const data = await getTemplateData(id); | ||
const [_, fileData] = | ||
Object.entries(data).find(([key]) => key === decodeURIComponent(file)) || | ||
[]; | ||
|
||
return <Editor defaultValue={strFromU8(fileData!)} lang={getLang(file)} />; | ||
} |
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,8 @@ | ||
export default function Page({ params: { id } }: { params: { id: string } }) { | ||
return ( | ||
<div className="p-4"> | ||
<h1 className="text-2xl">You have chosen template {id}.</h1> | ||
<p>Choose a file on the left to edit.</p> | ||
</div> | ||
); | ||
} |
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,13 @@ | ||
export enum Languages { | ||
CSHARP = "csharp", | ||
PROTOBUF = "protobuf", | ||
XML = "xml", | ||
} | ||
|
||
export function getLang(file: string) { | ||
if (file.endsWith("cs")) return Languages.CSHARP; | ||
|
||
if (file.endsWith("proto")) return Languages.PROTOBUF; | ||
|
||
if (file.endsWith("csproj")) return Languages.XML; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
"use client"; | ||
|
||
import * as React from "react"; | ||
|
||
import { MenubarItem } from "@/components/ui/menubar"; | ||
import Link from "next/link"; | ||
|
||
export function TemplateMenuItem({ children }: React.PropsWithChildren) { | ||
return ( | ||
<MenubarItem> | ||
<Link href={`/template/${children}`} className="w-full"> | ||
{children} | ||
</Link> | ||
</MenubarItem> | ||
); | ||
} |
Oops, something went wrong.