Conversation
Dao-Ho
left a comment
There was a problem hiding this comment.
Some comments / things to consider for next time. I think this is good to ship for the most part, for the ones I stated we can forego, no need to make those changes. Overall great ship! 🔥
| import { myTasks, unassignedTasks } from "@/data/mockTasks"; | ||
|
|
||
| export default function TasksScreen() { | ||
| const [activeTab, setActiveTab] = useState<"myTasks" | "unassigned">("myTasks"); |
There was a problem hiding this comment.
I'd make these constant/enum (MY_TASKS & UNASSIGNED) just make sure there's no potential of mispelling
| <View className="flex-1"> | ||
| <TaskList | ||
| tasks={activeTab === "myTasks" ? myTasks : unassignedTasks} | ||
| variant={activeTab === "myTasks" ? "assigned" : "unassigned"} |
There was a problem hiding this comment.
a ternary operator here really boxes you in to only two choices. What if we wanted to add another tab in the future (say, "overdue")?
I would actually define this data before passing the prop.
Something like would allow you to easily extend upon this code when we go and add in a new tab
const tabConfigs = {
myTasks: { tasks: myTasks, variant: "assigned", showFilters: false },
unassigned: { tasks: unassignedTasks, variant: "unassigned", showFilters: true },
};
const currentTabConfig = tabConfigs[activeTab];
...
<TaskList tasks={currentTabConfig.tasks} variant={currentTabConfig.variant} />
| export function ActiveFilterChips({ | ||
| filters, | ||
| onRemoveFilter = () => {}, | ||
| onClearAll = () => {}, |
There was a problem hiding this comment.
I wouldn't allow a default no-op here, we should enforce that these are passed into the component. We don't want any unexpected cases where the caller only passes the filters and questions why the remove functionality isn't working
| import MaterialCommunityIcons from "@expo/vector-icons/MaterialCommunityIcons"; | ||
| import { Pressable, Text, View } from "react-native"; | ||
|
|
||
| type TabId = "myTasks" | "unassigned"; |
There was a problem hiding this comment.
good place for the constant/enum mentioned above
| } | ||
|
|
||
| export function TaskCard({ task, variant, isExpanded }: TaskCardProps) { | ||
| const isAssigned = variant === "assigned"; |
|
|
||
| interface TaskCardProps { | ||
| task: Task; | ||
| variant: "assigned" | "unassigned"; |
| export function TaskList({ tasks, variant }: TaskListProps) { | ||
| const renderItem: ListRenderItem<Task> = ({ item, index }) => { | ||
| const isExpanded = | ||
| variant === "assigned" ? index === 0 : item.priority === "High"; |
There was a problem hiding this comment.
use const/enum for variant (no need for priority for now)
| <Feather name="sliders" size={24} color="#000" /> | ||
| </Pressable> | ||
| <Pressable onPress={() => {}}> | ||
| <Feather name="bell" size={24} color="#000" /> |
There was a problem hiding this comment.
Ok for now, but some things to consider about:
What if we wanted to update the styling of Feather? We'd need to make sure we remember to update it in all use cases of this. No need to do this for now but you should abstract and make it a separate component whenever you see a case like this
| dueTime?: string; | ||
| isAssigned: boolean; | ||
| } | ||
|
|
There was a problem hiding this comment.
This is ok for now since it's mock data but for types, I'd keep this in a separate file in the future
a /types seems appropriate to store this
Updated ActiveFilterChipsProps to require onRemoveFilter and onClearAll callbacks.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #132 +/- ##
======================================
Coverage ? 4.03%
======================================
Files ? 45
Lines ? 1337
Branches ? 24
======================================
Hits ? 54
Misses ? 1283
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
* Mobile tasks (#132) * add mock task data and Task type definition * add TaskBadge and TasksHeader components * add TabBar and ActiveFilterChips components * add TaskCard and TaskList components * added tasks tab screen and register in tab navigator * fix babel.config * icon * Refactor activeTab state to use TabName type * Refactor task handling with tabConfigs * Refactor ActiveFilterChipsProps to enforce required props Updated ActiveFilterChipsProps to require onRemoveFilter and onClearAll callbacks. * Refactor tab identifiers to use constants * made constant file with VARIANT and TAB and replaced string literals * packagelock.json * attempting to update package and package lock * attempt 2 * attempt 3 * VARIENT name change * ran npx prettier --write --------- Co-authored-by: Dao Ho <84757503+Dao-Ho@users.noreply.github.com> * Feat/guest and booking endpoint (#178) * rooms migration file * feat: guest booking migration * rls fix * indexes on both tables * type fix * incomplete guest bookings table + endpoint * server integrated + openapi * moved getRooms to rooms repo * get guests endpoint * changes * fixed openapi * remove stale webhook dir * route for specific guest info * cleanup GetBookingsByFloor handler * changed some models * filtered by hotel id * lint * may the lint gods be merciful * comments * fixed issue * rename --------- Co-authored-by: eric-kitagawa <kitagawa.e@northeastern.edu> * migration 1 -> add request_version column and drop updated_at column (#188) * migration file 2, instead of request_id primary key -> (request_id, request_version) composite key (#190) * guest info added (#182) * feat: reveal rooms page in dashboard + updated some styling (#192) * reveal rooms page in dashboard * updated selected styling + tags styling * update side panel buttons to use primary color as well * format * lint --------- Co-authored-by: Ari Spokony <spokonya@outlook.com> Co-authored-by: Manuel Torres <torres.man@northeastern.edu> Co-authored-by: eric-kitagawa <kitagawa.e@northeastern.edu> Co-authored-by: Tyler Kim <tdk737@gmail.com>
Description
Adds the Tasks page UI to the staff mobile app with two sub-tabs: My Tasks (assigned) and Unassigned Tasks. Task cards display priority, location, department, and description with expanded and compact layouts depending on assignment status. All data is hardcoded
Type of Change
Related Issue(s)
Closes #103
Related to #
What Changed?
-Add Tasks tab screen with My Tasks / Unassigned Tasks sub-tabs displaying hardcoded task data
-Build task card components with expanded (Start/Claim Task button) and compact (badge + three-dot menu) variants
-Register Tasks tab in bottom navigator with checklist icon
Testing & Validation
How this was tested
Screenshots/Recordings
Unfinished Work & Known Issues
Notes & Nuances
Pre-Merge Checklist
Code Quality
Testing & CI
Documentation
Reviewer Notes