Skip to content

Commit d301697

Browse files
committed
[frontend] add about/version page
1 parent be6e182 commit d301697

File tree

3 files changed

+80
-3
lines changed

3 files changed

+80
-3
lines changed

frontend/src/Tab.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
import { NewTab } from "./pages/NewTab";
1010
import { Playground } from "./pages/Playground";
1111
import { createMenu } from "./components/Menu";
12+
import { About } from "./pages/About";
1213

1314
const requestInspectElement = createDelegate<[HTMLElement, Tab]>();
1415

@@ -86,6 +87,9 @@ export class Tab extends StatefulClass {
8687
this.title = "Scramjet Playground";
8788
this.internalpage = <Playground tab={this} />;
8889
break;
90+
case "version":
91+
this.title = "About Version";
92+
this.internalpage = <About tab={this} />;
8993
}
9094
} else {
9195
this.internalpage = null;

frontend/src/components/Omnibox.tsx

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import iconBack from "@ktibow/iconset-ion/arrow-back";
33
import iconForwards from "@ktibow/iconset-ion/arrow-forward";
44
import iconRefresh from "@ktibow/iconset-ion/refresh";
55
import iconExtension from "@ktibow/iconset-ion/extension-puzzle-outline";
6-
import iconSettings from "@ktibow/iconset-ion/settings-outline";
6+
import iconMore from "@ktibow/iconset-ion/more";
77
import iconShield from "@ktibow/iconset-ion/shield-outline";
88
import iconStar from "@ktibow/iconset-ion/star-outline";
99
import iconSearch from "@ktibow/iconset-ion/search";
@@ -289,11 +289,35 @@ export const Omnibox: Component<{
289289
<Spacer></Spacer>
290290
<IconButton icon={iconExtension}></IconButton>
291291
<IconButton
292-
icon={iconSettings}
292+
icon={iconMore}
293293
click={(e: MouseEvent) => {
294-
createMenu(e.x, e.y, [
294+
createMenu(e.x, cx.root.clientTop + cx.root.clientHeight * 2, [
295+
{
296+
label: "New Tab",
297+
action: () => {
298+
browser.newTab();
299+
},
300+
},
301+
{
302+
label: "History",
303+
action: () => {
304+
let t = browser.newTab();
305+
t.replaceNavigate(new URL("puter://history"));
306+
},
307+
},
295308
{
296309
label: "Settings",
310+
action: () => {
311+
let t = browser.newTab();
312+
t.replaceNavigate(new URL("puter://settings"));
313+
},
314+
},
315+
{
316+
label: "About",
317+
action: () => {
318+
let t = browser.newTab();
319+
t.replaceNavigate(new URL("puter://version"));
320+
},
297321
},
298322
]);
299323
e.stopPropagation();

frontend/src/pages/About.tsx

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import { css, type Component } from "dreamland/core";
2+
import type { Tab } from "../Tab";
3+
import { scramjet } from "../main";
4+
5+
export const About: Component<
6+
{
7+
tab: Tab;
8+
},
9+
{}
10+
> = function (cx) {
11+
return (
12+
<div>
13+
<div class="main">
14+
<h1>Puter Browser</h1>
15+
Scramjet Version: {$scramjetVersion.build} {$scramjetVersion.version}
16+
</div>
17+
</div>
18+
);
19+
};
20+
About.style = css`
21+
:scope {
22+
width: 100%;
23+
height: 100%;
24+
display: flex;
25+
justify-content: center;
26+
font-family: sans-serif;
27+
}
28+
29+
.main {
30+
width: 70%;
31+
display: flex;
32+
flex-direction: column;
33+
align-items: center;
34+
}
35+
36+
input {
37+
width: 100%;
38+
height: 2em;
39+
font-size: 1.5em;
40+
border: 2px solid #ccc;
41+
outline: none;
42+
border-radius: 4px;
43+
}
44+
45+
.main {
46+
position: relative;
47+
top: 10em;
48+
}
49+
`;

0 commit comments

Comments
 (0)