From 5de76238c357b30abb8bbc2050dc3041e8af1049 Mon Sep 17 00:00:00 2001 From: Azlothe Date: Sun, 19 May 2024 10:38:28 -0700 Subject: [PATCH 1/7] draft status sidebar --- src/components/Widget/HistoryWidget.tsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/components/Widget/HistoryWidget.tsx b/src/components/Widget/HistoryWidget.tsx index 02458ad..a50658c 100644 --- a/src/components/Widget/HistoryWidget.tsx +++ b/src/components/Widget/HistoryWidget.tsx @@ -7,13 +7,23 @@ type HistoryWidgetProps = { const HistoryWidget = ({ widget }: HistoryWidgetProps) => { const { id, x, y, w, h, elements } = widget; + console.log('elements: ', elements); + return (
- History Widget +
+ + 4 + +
+
+ +
message content
+
test
); }; From 84851cae4ff34e7696abd48ee779be051b2dd374 Mon Sep 17 00:00:00 2001 From: Azlothe Date: Sun, 19 May 2024 20:51:10 -0700 Subject: [PATCH 2/7] test with mock data --- .../Element/Simple/TableElement.tsx | 10 +- src/components/Widget/HistoryWidget.tsx | 92 +++++++++++++++++-- 2 files changed, 90 insertions(+), 12 deletions(-) diff --git a/src/components/Element/Simple/TableElement.tsx b/src/components/Element/Simple/TableElement.tsx index 16e99ab..aa250de 100644 --- a/src/components/Element/Simple/TableElement.tsx +++ b/src/components/Element/Simple/TableElement.tsx @@ -13,12 +13,16 @@ const TableElement = ({ element, children }: TableElementProps) => { const renderTable = () => { return ( - +
{Array.from({ length: rows }).map((_, i) => ( - + {Array.from({ length: cols }).map((_, j) => ( - + ))} ))} diff --git a/src/components/Widget/HistoryWidget.tsx b/src/components/Widget/HistoryWidget.tsx index a50658c..0fa83bb 100644 --- a/src/components/Widget/HistoryWidget.tsx +++ b/src/components/Widget/HistoryWidget.tsx @@ -1,4 +1,5 @@ import { type HistoryWidget as HistoryWidgetType } from 'src/types/widget'; +import TableElement from '../Element/Simple/TableElement'; type HistoryWidgetProps = { widget: HistoryWidgetType; @@ -13,17 +14,90 @@ const HistoryWidget = ({ widget }: HistoryWidgetProps) => {
-
- - 4 - -
-
+
-
message content
-
test
+ {/* TODO : extract out into HistoryMessageElement. Currently is mock data to test look */} + +
+ + 4 + +
+
+ +
+
+
+
+
ACA-7
+ Request to attack +
+
Approval for kinetic attack
+
+ +
+ ', + modality: 'visual', + h: 3, + w: 4, + + type: 'table', + rows: 4, + cols: 2, + tableData: [ + ['location', '34N, 118W'], + ['priority', 'high'], + ['threat-level', 'high'], + ['col.damage', '45%'], + ], + }} + /> +
+
+
+ +
+ + 3 + +
+
+ +
+
+
+
+
Update
+ Threat Level High +
+
+
+ +
+ ', + modality: 'visual', + h: 3, + w: 4, + + type: 'table', + rows: 2, + cols: 2, + tableData: [ + ['priority', 'high'], + ['threat-level', 'high'], + ], + }} + /> +
+
+
+
); }; From 5142e50bbd995caef1fed18ec70db27bf2e0443b Mon Sep 17 00:00:00 2001 From: Azlothe Date: Sun, 19 May 2024 21:18:35 -0700 Subject: [PATCH 3/7] fix misaligned tables --- .../Element/Simple/TableElement.tsx | 19 ++++++++++++------- src/components/Widget/HistoryWidget.tsx | 2 +- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/components/Element/Simple/TableElement.tsx b/src/components/Element/Simple/TableElement.tsx index aa250de..501c8f6 100644 --- a/src/components/Element/Simple/TableElement.tsx +++ b/src/components/Element/Simple/TableElement.tsx @@ -13,16 +13,21 @@ const TableElement = ({ element, children }: TableElementProps) => { const renderTable = () => { return ( -
{tableData[i][j]} 0 ? 'border-l-2' : 'border-x-0'} ${j === 0 && 'text-[#bcbcbc]'} border-[#585864] py-1`}> +
+ {tableData[i][j]} +
+
+
{Array.from({ length: rows }).map((_, i) => ( - + {Array.from({ length: cols }).map((_, j) => ( - + ))} ))} diff --git a/src/components/Widget/HistoryWidget.tsx b/src/components/Widget/HistoryWidget.tsx index 0fa83bb..5d19267 100644 --- a/src/components/Widget/HistoryWidget.tsx +++ b/src/components/Widget/HistoryWidget.tsx @@ -21,7 +21,7 @@ const HistoryWidget = ({ widget }: HistoryWidgetProps) => { {/* TODO : extract out into HistoryMessageElement. Currently is mock data to test look */}
- + 4
From 887e2f7518bfded96255981b901e3e01b33b4015 Mon Sep 17 00:00:00 2001 From: Azlothe Date: Sun, 19 May 2024 21:29:13 -0700 Subject: [PATCH 4/7] extract color into props --- src/components/Element/Simple/TableElement.tsx | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/components/Element/Simple/TableElement.tsx b/src/components/Element/Simple/TableElement.tsx index 501c8f6..de7e04b 100644 --- a/src/components/Element/Simple/TableElement.tsx +++ b/src/components/Element/Simple/TableElement.tsx @@ -6,9 +6,21 @@ type TableElementProps = { // children for nested elements that Tom mentioned. children?: ReactNode; // and more props to perhaps control position of the children + + borderColor?: string; + evenAlternatingColor?: string; + oddAlternatingColor?: string; + leftLabelColor?: string; }; -const TableElement = ({ element, children }: TableElementProps) => { +const TableElement = ({ + element, + children, + borderColor = '#585864', + evenAlternatingColor = '#202021', + oddAlternatingColor = '#00FFFFFF', + leftLabelColor = '#bcbcbc', +}: TableElementProps) => { const { rows, cols, tableData } = element; const renderTable = () => { @@ -17,13 +29,13 @@ const TableElement = ({ element, children }: TableElementProps) => {
{Array.from({ length: rows }).map((_, i) => ( {Array.from({ length: cols }).map((_, j) => (
0 ? 'border-l-2' : 'border-x-0'} ${j === 0 && 'text-[#bcbcbc]'} border-[#585864] py-1`}> -
- {tableData[i][j]} -
-
0 ? 'border-l-2' : 'border-x-0'} ${j === 0 && 'text-[#bcbcbc]'} border-[#585864] py-1`} + style={{ width: `${100 / cols}%` }} + > +
{tableData[i][j]}
+
0 ? 'border-l-2' : 'border-x-0'} ${j === 0 && 'text-[#bcbcbc]'} border-[#585864] py-1`} + className={`${j > 0 ? 'border-l-2' : 'border-x-0'} ${j === 0 && `text-[${leftLabelColor}]`} border-[${borderColor}] py-1`} style={{ width: `${100 / cols}%` }} >
{tableData[i][j]}
From 2a534771c1cd08360c2fbb376e6ce7d06bef28e5 Mon Sep 17 00:00:00 2001 From: Azlothe Date: Sun, 19 May 2024 22:31:27 -0700 Subject: [PATCH 5/7] bugfix: tailwind template strings do not work --- src/components/Element/Simple/TableElement.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/Element/Simple/TableElement.tsx b/src/components/Element/Simple/TableElement.tsx index de7e04b..2c2c491 100644 --- a/src/components/Element/Simple/TableElement.tsx +++ b/src/components/Element/Simple/TableElement.tsx @@ -16,26 +16,26 @@ type TableElementProps = { const TableElement = ({ element, children, - borderColor = '#585864', - evenAlternatingColor = '#202021', - oddAlternatingColor = '#00FFFFFF', - leftLabelColor = '#bcbcbc', + borderColor = 'border-[#585864]', + evenAlternatingColor = 'bg-[#202021]', + oddAlternatingColor = 'bg-[rgba(0,0,0,0)]', + leftLabelColor = 'text-[#bcbcbc]', }: TableElementProps) => { const { rows, cols, tableData } = element; const renderTable = () => { return ( - +
{Array.from({ length: rows }).map((_, i) => ( {Array.from({ length: cols }).map((_, j) => (
0 ? 'border-l-2' : 'border-x-0'} ${j === 0 && `text-[${leftLabelColor}]`} border-[${borderColor}] py-1`} + className={`${j > 0 ? 'border-l-2' : 'border-x-0'} ${j === 0 && leftLabelColor} ${borderColor} py-1`} style={{ width: `${100 / cols}%` }} >
{tableData[i][j]}
From 5adcd08d9f98568c1c76f31031b4e38c492304a3 Mon Sep 17 00:00:00 2001 From: Azlothe Date: Sun, 19 May 2024 22:41:37 -0700 Subject: [PATCH 6/7] add tailwind colors into config --- tailwind.config.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tailwind.config.js b/tailwind.config.js index 3b67ddc..31b1a64 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,5 +1,5 @@ /** @type {import('tailwindcss').Config} */ -export default { +const tailwindConfig = { content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'], theme: { extend: { @@ -8,6 +8,16 @@ export default { // pointer: 'url(https://i.stack.imgur.com/UOvLJ.png), pointer', // }, }, + colors: { + ...require('tailwindcss/colors'), + turquoise: "#19debb", + "muted-gray": "#97979d", + convo: { + bar: "#656566", + }, + }, }, plugins: [], }; + +export default tailwindConfig; \ No newline at end of file From 943ca33f0d9b0f8faca2a8a7f927a8d0922d6332 Mon Sep 17 00:00:00 2001 From: Azlothe Date: Sun, 19 May 2024 22:46:18 -0700 Subject: [PATCH 7/7] replace color settings to tailwind custom classes --- src/components/Widget/HistoryWidget.tsx | 10 +++++----- tailwind.config.js | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/Widget/HistoryWidget.tsx b/src/components/Widget/HistoryWidget.tsx index 5d19267..d78b244 100644 --- a/src/components/Widget/HistoryWidget.tsx +++ b/src/components/Widget/HistoryWidget.tsx @@ -17,21 +17,20 @@ const HistoryWidget = ({ widget }: HistoryWidgetProps) => { className={`absolute text-white `} >
- {/* TODO : extract out into HistoryMessageElement. Currently is mock data to test look */}
- + 4 -
+
-
+
-
ACA-7
+
ACA-7
Request to attack
Approval for kinetic attack
@@ -60,6 +59,7 @@ const HistoryWidget = ({ widget }: HistoryWidgetProps) => {
+ {/* to be removed */}
3 diff --git a/tailwind.config.js b/tailwind.config.js index 31b1a64..984ed9e 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -14,6 +14,7 @@ const tailwindConfig = { "muted-gray": "#97979d", convo: { bar: "#656566", + bg: "#252526", }, }, },