From b1b6b0ce4d3226619f0021afd8b17c9d56e6fdce Mon Sep 17 00:00:00 2001 From: code002lover Date: Fri, 5 Dec 2025 14:51:25 +0100 Subject: [PATCH] feat: add current user detection and conditional routing for PersonList items, removing refresh functionality. --- frontend/src/PersonList.tsx | 71 ++++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 29 deletions(-) diff --git a/frontend/src/PersonList.tsx b/frontend/src/PersonList.tsx index 451018d..b55af32 100644 --- a/frontend/src/PersonList.tsx +++ b/frontend/src/PersonList.tsx @@ -1,12 +1,19 @@ import { Person } from "../items"; import { Link } from "react-router-dom"; +import { useState } from "react"; +import { get_auth_status } from "./api"; interface Props { people: Person[]; - onRefresh: () => void; } -export const PersonList = ({ people, onRefresh }: Props) => { +export const PersonList = ({ people }: Props) => { + const [current_user, set_current_user] = useState(""); + get_auth_status().then((res) => { + if (res) { + set_current_user(res.username); + } + }); return (
{ }} >

People List

-
- {people.map((person, index) => ( - -

{person.name}

-
    - {person.opinion.map((op, i) => ( -
  • - {op.title} - {op.wouldPlay ? "Would Play" : "Would Not Play"} -
  • - ))} -
- - ))} + {people.map((person, index) => { + if (person.name == current_user) { + return ( + +

{person.name}

+ + ); + } + + return ( + +

{person.name}

+ + ); + })}
);