From 8a8a69b08282a805d9c26b6dcf8abc094de771b8 Mon Sep 17 00:00:00 2001 From: Amy Dang Date: Thu, 5 Oct 2023 14:15:39 -0700 Subject: [PATCH 1/6] add a window title bar #23 --- src/components/WindowTitleBar.tsx | 25 +++++++++++++ src/pages/Homepage.tsx | 62 ++++++++++++++++--------------- 2 files changed, 58 insertions(+), 29 deletions(-) create mode 100644 src/components/WindowTitleBar.tsx diff --git a/src/components/WindowTitleBar.tsx b/src/components/WindowTitleBar.tsx new file mode 100644 index 0000000..71fd905 --- /dev/null +++ b/src/components/WindowTitleBar.tsx @@ -0,0 +1,25 @@ +import { username, hostname, path } from "../../constants"; + +const WindowTitleBar = (props: { customUserName: string }) => { + return ( +
+ +
+ x +
+
+ - +
+
+ □ +
+
+ + {props.customUserName == "" ? username : props.customUserName}@ + {hostname}:{path} + +
+ ); +}; + +export default WindowTitleBar; diff --git a/src/pages/Homepage.tsx b/src/pages/Homepage.tsx index cd5d9a7..1852cbe 100644 --- a/src/pages/Homepage.tsx +++ b/src/pages/Homepage.tsx @@ -5,6 +5,7 @@ import info from "../../data.json"; const options = info.options.map((option) => option.label); import { Queue } from "queue-typescript"; import PromptBar from "../components/PromptBar"; +import WindowTitleBar from "../components/WindowTitleBar"; const historyCommand = new Queue(); let count = 1; @@ -185,36 +186,39 @@ function Homepage() { }, []); return ( -
- { - /* History */ - history.map((history) => ( -
- - {history.command}
- -
- )) - } - {/* Prompt */} -
- - -
- -
-
+ <> + +
+ { + /* History */ + history.map((history) => ( +
+ + {history.command}
+ +
+ )) + } + {/* Prompt */} +
+ + +
+ +
+
+
-
+ ); } From c6d86e9886c84a52274b9f3272108b88b6fc3c7d Mon Sep 17 00:00:00 2001 From: Amy Dang Date: Thu, 5 Oct 2023 14:16:53 -0700 Subject: [PATCH 2/6] remove whitespace --- src/components/WindowTitleBar.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/WindowTitleBar.tsx b/src/components/WindowTitleBar.tsx index 71fd905..0e14809 100644 --- a/src/components/WindowTitleBar.tsx +++ b/src/components/WindowTitleBar.tsx @@ -4,13 +4,13 @@ const WindowTitleBar = (props: { customUserName: string }) => { return (
-
+
x
-
+
-
-
+
From 069efe57a13ca7ae33e190f027e7fb270144b842 Mon Sep 17 00:00:00 2001 From: Amy Dang Date: Fri, 6 Oct 2023 13:47:05 -0700 Subject: [PATCH 3/6] add window title bar to Profile page --- src/pages/Profile.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pages/Profile.tsx b/src/pages/Profile.tsx index a0c8618..db7ea59 100644 --- a/src/pages/Profile.tsx +++ b/src/pages/Profile.tsx @@ -3,6 +3,7 @@ import { getData, setUsername } from "../api"; import { useEffect, useRef, useState } from "react"; import PromptBar from "../components/PromptBar"; import commands from "../commands.json"; +import WindowTitleBar from "../components/WindowTitleBar"; interface State { history: { @@ -260,6 +261,7 @@ function Profile() { }, []); return (
+ {state.showWelcomeMessage && (

Type 'help' to view all available commands From f13af5683b573f859c39323dfbcb1b885fe5aca6 Mon Sep 17 00:00:00 2001 From: Amy Dang Date: Fri, 6 Oct 2023 13:57:37 -0700 Subject: [PATCH 4/6] fix: prop name typo 'customUserName' --- src/pages/Profile.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/Profile.tsx b/src/pages/Profile.tsx index 8ebd429..8c9a882 100644 --- a/src/pages/Profile.tsx +++ b/src/pages/Profile.tsx @@ -390,7 +390,7 @@ function Profile() { }, []); return (

- + {state.showWelcomeMessage && (

Type 'help' to view all available commands From c5f7cacc6833f85a7ba665ed3a7600f6fbadd7ce Mon Sep 17 00:00:00 2001 From: Amy Dang Date: Fri, 6 Oct 2023 14:06:49 -0700 Subject: [PATCH 5/6] center x symbole #23 --- src/components/WindowTitleBar.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/WindowTitleBar.tsx b/src/components/WindowTitleBar.tsx index 0e14809..1e0841a 100644 --- a/src/components/WindowTitleBar.tsx +++ b/src/components/WindowTitleBar.tsx @@ -5,7 +5,7 @@ const WindowTitleBar = (props: { customUserName: string }) => {

- x + ×
- From 389c653d057f70b0683190eeda0473fbfff296a1 Mon Sep 17 00:00:00 2001 From: Amy Dang Date: Tue, 24 Oct 2023 14:05:17 -0700 Subject: [PATCH 6/6] use icons instead of HTML unicode --- src/components/WindowTitleBar.tsx | 45 ++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/src/components/WindowTitleBar.tsx b/src/components/WindowTitleBar.tsx index 1e0841a..fc21c7f 100644 --- a/src/components/WindowTitleBar.tsx +++ b/src/components/WindowTitleBar.tsx @@ -5,13 +5,52 @@ const WindowTitleBar = (props: { customUserName: string }) => {
- × + + +
- - + + +
- □ + + +