+
+
Topics
+ {/* Selected Topics Display */}
+
+
{/* Existing Topic Selection */}
- {/* Selected Topics Display */}
- {topics.map((topic, index) => {
- if (topic.type === "existing") {
- const topicData = availableTopics.find((t) => t.id === topic.id);
- if (!topicData) return null;
- return (
-
- {topicData.name}
-
-
- );
- }
-
- return (
-
- {
- const newTopics = [...topics];
- newTopics[index] = { ...topic, name: e.target.value };
- setTopics(newTopics);
- }}
- />
- {
- const hex = parseInt(e.target.value.replace("#", ""), 16);
- const copy = [...topics];
- copy[index] = { ...topic, color_hex: hex };
- setTopics(copy);
- }}
- />
-
-
- );
- })}
-
);
diff --git a/client/src/components/topic_tag.tsx b/client/src/components/topic_tag.tsx
index 17446b1..b4e8bff 100644
--- a/client/src/components/topic_tag.tsx
+++ b/client/src/components/topic_tag.tsx
@@ -13,19 +13,60 @@ A small rounded label containing the topic's name and a circle of the colour
stored in color_hex.
*/
function TopicTag({ name, color_hex }: TopicTagProps) {
- const bg_color = "#" + color_hex.toString(16).padStart(6, "0");
-
+ const color_hex_code = "#" + color_hex.toString(16).padStart(6, "0");
return (
-
+
- {" "}
-
-
{name}
+ className="topic-tag-color aspect-1/1 mr-1 min-h-2 min-w-2 rounded-full"
+ style={{ backgroundColor: color_hex_code }}
+ >
+
{name}
);
}
export default TopicTag;
+
+function getHexColorValues(hex: string) {
+ const r = parseInt(hex.substring(1, 3), 16);
+ const g = parseInt(hex.substring(3, 5), 16);
+ const b = parseInt(hex.substring(5, 7), 16);
+
+ return { r: r, g: g, b: b };
+}
+
+function modifyBrightness(hex: string, brightness: number): string {
+ const { r, g, b } = getHexColorValues(hex);
+
+ const brightness_modifier = Math.floor((256 * (brightness - 100)) / 100);
+
+ const new_r = Math.min(255, Math.max(0, r + brightness_modifier));
+ const new_g = Math.min(255, Math.max(0, g + brightness_modifier));
+ const new_b = Math.min(255, Math.max(0, b + brightness_modifier));
+
+ const r_str = new_r.toString(16).padStart(2, "0");
+ const g_str = new_g.toString(16).padStart(2, "0");
+ const b_str = new_b.toString(16).padStart(2, "0");
+
+ return "#" + r_str + g_str + b_str;
+}
+
+export function TopicTagAlt({ name, color_hex }: TopicTagProps) {
+ const color_hex_code = "#" + color_hex.toString(16).padStart(6, "0");
+
+ const foreground_hex_code = modifyBrightness(color_hex_code, 125);
+ const background_hex_code = modifyBrightness(color_hex_code, 60);
+
+ return (
+
+ );
+}
diff --git a/client/src/components/ui/logout.tsx b/client/src/components/ui/logout.tsx
index 22d787b..13bdc6c 100644
--- a/client/src/components/ui/logout.tsx
+++ b/client/src/components/ui/logout.tsx
@@ -14,7 +14,7 @@ export function LogoutButton() {
return (
diff --git a/client/src/components/ui/navbar.tsx b/client/src/components/ui/navbar.tsx
index 1995d4c..9bd0154 100644
--- a/client/src/components/ui/navbar.tsx
+++ b/client/src/components/ui/navbar.tsx
@@ -10,8 +10,8 @@ export function Navbar() {
const linkClass = (path: string) =>
pathname === path
- ? "rounded-md bg-gray-950/50 px-3 py-2 text-sm font-medium text-white"
- : "rounded-md px-3 py-2 text-sm font-medium text-gray-300 hover:bg-white/5 hover:text-white";
+ ? "rounded-md bg-gray-950/50 px-3 py-2 text-xl font-bold text-white"
+ : "rounded-md px-3 py-2 text-xl font-bold text-gray-300 hover:bg-white/5 hover:text-white";
return (