From 98b1f83dc1c0fea22a2f0e09cff8ff33b226ded5 Mon Sep 17 00:00:00 2001 From: Arindam Majumder Date: Thu, 15 Feb 2024 10:48:54 +0530 Subject: [PATCH 1/2] fix: Refactor Inline Styles of App.tsx to global.css --- src/app/App.tsx | 119 +++++------------------------------ src/app/global.css | 151 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 166 insertions(+), 104 deletions(-) diff --git a/src/app/App.tsx b/src/app/App.tsx index 6ae7687..755f0c8 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -88,114 +88,40 @@ export function App(): React.JSX.Element { return ( -
+
- {error &&
Pieces OS is not running in the background. Click You're Not Connected to connect
} -
-
-

Workflow Activity

+ {error &&
Pieces OS is not running in the background. Click You're Not Connected to connect
} +
+
+

Workflow Activity

-
-
- -
-

Saved Snippets

- -
-
+
{array.map((item: LocalAsset, index) => (
handleSelect(index)} >

{item.name}

-
+

{item.id}

{item.classification}

@@ -206,8 +132,8 @@ export function App(): React.JSX.Element {
-
-

Create a New Snippet

+
+

Create a New Snippet

@@ -216,18 +142,7 @@ export function App(): React.JSX.Element {
{/* this is the copilot container. the copilot logic is inside the /components/Copilot.tsx */} -
+
diff --git a/src/app/global.css b/src/app/global.css index b2dcd9f..1a9e165 100644 --- a/src/app/global.css +++ b/src/app/global.css @@ -1,7 +1,7 @@ - +/* */ html { - font-family: 'Roboto', sans-serif; + font-family: "Roboto", sans-serif; } ::-webkit-scrollbar { @@ -21,4 +21,151 @@ html { background-color: #b3b2b2; } +.container { + padding: 10px 20px; +} + +.error-container { + border: 2px solid black; + background-color: #0e1111; + color: red; + /* minWidth: '1175px', + maxWidth: '1175px', */ + padding: 20px; + border-radius: 9px; + display: flex; + box-shadow: -4px 4px 5px rgba(0, 0, 0, 0.2); + margin-bottom: 10px; +} + +.flex-container { + display: flex; + flex: 1; + flex-direction: row-reverse; +} + +.workflow-activity-container { + border: 2px solid black; + background-color: #0e1111; + height: 600px; + min-width: 250px; + /* maxWidth: '1175px', */ + padding: 20px; + border-radius: 9px; + display: flex; + flex: 1; + flex-direction: column; + box-shadow: -4px 4px 5px rgba(0, 0, 0, 0.2); +} + +.activity-heading { + color: white; + font-weight: normal; +} + +.snippets-container { + /* width: "auto", */ + border: 2px solid yellow; + background-color: #0e1111; + height: 600px; + min-width: 1000px; + /* maxWidth: '1175px', */ + padding: 20px; + border-radius: 9px; + display: flex; + flex: 1; + margin-right: 10px; + box-shadow: -4px 4px 5px rgba(0, 0, 0, 0.2); +} + +.snippets-header { + min-height: 100%; + display: flex; + flex-direction: column; + justify-content: space-between; +} + +.snippets-subheader { + display: flex; + flex-direction: row; + align-items: center; +} + +.snippets-heading { + color: white; + font-weight: normal; + margin: 5px; +} + +.snippets-heading-2 { + color: white; + font-weight: normal; +} + +.snippet-grid-container { + display: flex; + flex-direction: column; + padding: 10px; + max-height: 90%; + align-self: end; + margin-left: 10px; +} + +.refresh-btn, +.deselect-btn { + max-width: fit-content; + height: fit-content; + margin-left: 10px; + background-color: black; + border: 1px solid white; + border-radius: 5px; + padding: 8px 24px; + color: white; + flex-wrap: nowrap; + cursor: pointer; + font-size: 12px; +} + +.snippets-grid { + overflow-y: scroll; + min-width: 700px; + min-height: 80%; + padding-right: 5px; + display: grid; + grid-template-columns: repeat(3, 1fr); + grid-template-rows: repeat(3, 1fr); + gap: 5px; +} + +.snippet-item { + margin: 5px; + align-items: center; + padding: 10px; + border-radius: 5px; + height: 200px; + width: 200px; + display: flex; + flex-direction: row; + justify-content: space-between; + /* background-color: white; */ + cursor: pointer; /* Add cursor style to indicate clickability */ +} + +.snippet-item.selected { + background-color: lightblue; +} + +.snippet-details { + flex-direction: column; +} +.copilot-container { + border: 2px solid black; + background-color: #0e1111; + height: 600px; + padding: 20px; + border-radius: 9px; + display: flex; + box-shadow: -4px 4px 5px rgba(0, 0, 0, 0.2); + margin-top: 20px; +} From 77138f808f567cee70f0d68dee171500ecda5135 Mon Sep 17 00:00:00 2001 From: Arindam Majumder Date: Thu, 15 Feb 2024 23:57:20 +0530 Subject: [PATCH 2/2] fix: Undefined chatSelected Variable --- src/app/components/Copilot/Copilot.tsx | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/app/components/Copilot/Copilot.tsx b/src/app/components/Copilot/Copilot.tsx index 0759288..5e700b0 100644 --- a/src/app/components/Copilot/Copilot.tsx +++ b/src/app/components/Copilot/Copilot.tsx @@ -140,12 +140,22 @@ export function CopilotChat(): React.JSX.Element { const getInitialChat = async () => { let _name: string; - await new Pieces.ConversationsApi().conversationsSnapshot({}).then(output => { - _name = output.iterable.at(0).name; - GlobalConversationID = output.iterable.at(0).id; - return output.iterable.at(0).name - }); - setChatSelected(_name); + await new Pieces.ConversationsApi() + .conversationsSnapshot({}) + .then((output) => { + if ( + output.iterable.length > 0 && + output.iterable.at(0).hasOwnProperty("name") + ) { + _name = output.iterable.at(0).name; + GlobalConversationID = output.iterable.at(0).id; + } + return _name; + }); + + if (_name) { + setChatSelected(_name); + } }; getInitialChat(); }, []);