From 67a1ccb625c320caed824d25d2427968816960e7 Mon Sep 17 00:00:00 2001 From: Fabius Gasber Date: Mon, 8 Jan 2024 13:51:21 +0100 Subject: [PATCH 1/5] Fix Bug: company names are missing --- src/constants.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constants.js b/src/constants.js index 853ebb5..42934a9 100644 --- a/src/constants.js +++ b/src/constants.js @@ -7,7 +7,7 @@ export const COMPANIES_API_PATH = "/companies"; export const COMPANIES_TABLE_HEADERS = ["Company Name", "Status", "Created At", "Revenue YTD", "Account Executive"]; -export const COMPANY_NAME_FIELD_NAME = "company_name"; +export const COMPANY_NAME_FIELD_NAME = "name"; export const STATUS_FIELD_NAME = "status"; export const CREATED_AT_FIELD_NAME = "created_at"; export const REVENUE_YTD_FIELD_NAME = "revenue_ytd"; From e07383e894682c3a53317e102c95b53c400c03bd Mon Sep 17 00:00:00 2001 From: Fabius Gasber Date: Mon, 8 Jan 2024 15:54:40 +0100 Subject: [PATCH 2/5] Feature request: display dates in 24-hour time format --- src/ui.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ui.js b/src/ui.js index 5682dea..dfd1e49 100644 --- a/src/ui.js +++ b/src/ui.js @@ -1,3 +1,4 @@ +import { at } from "lodash"; import {fetchCompanies} from "./api"; import { ACCOUNT_EXECUTIVE_FIELD_NAME, @@ -25,7 +26,7 @@ export const makeTable = async () => { row.push( company[COMPANY_NAME_FIELD_NAME], company[STATUS_FIELD_NAME], - company[CREATED_AT_FIELD_NAME], + company[CREATED_AT_FIELD_NAME] = convertDate(company[CREATED_AT_FIELD_NAME]), company[REVENUE_YTD_FIELD_NAME], company[ACCOUNT_EXECUTIVE_FIELD_NAME] ); @@ -44,4 +45,8 @@ export const makeTable = async () => { td.innerText = column; // Take string from placeholder variable and append it to node }); }); + + function convertDate(date){ + return date.slice(11,16); + } }; \ No newline at end of file From a88a806864094fd1af827fb427d7bf3616b53904 Mon Sep 17 00:00:00 2001 From: Fabius Gasber Date: Mon, 8 Jan 2024 16:05:43 +0100 Subject: [PATCH 3/5] Display Dates in 24-hour Time Format --- src/ui.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ui.js b/src/ui.js index dfd1e49..2d31ef0 100644 --- a/src/ui.js +++ b/src/ui.js @@ -47,6 +47,7 @@ export const makeTable = async () => { }); function convertDate(date){ - return date.slice(11,16); + let reformatDate = new Date(date); + return reformatDate.toLocaleTimeString([], { hour:"2-digit", minute:"2-digit" }); } }; \ No newline at end of file From 98058b06d771701595f469e876e2125cba9fb0df Mon Sep 17 00:00:00 2001 From: Fabius Gasber Date: Mon, 8 Jan 2024 17:02:35 +0100 Subject: [PATCH 4/5] Display revenue numbers in a human readable format --- src/ui.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ui.js b/src/ui.js index 2d31ef0..a90c5d9 100644 --- a/src/ui.js +++ b/src/ui.js @@ -27,7 +27,7 @@ export const makeTable = async () => { company[COMPANY_NAME_FIELD_NAME], company[STATUS_FIELD_NAME], company[CREATED_AT_FIELD_NAME] = convertDate(company[CREATED_AT_FIELD_NAME]), - company[REVENUE_YTD_FIELD_NAME], + company[REVENUE_YTD_FIELD_NAME] = convertNumbers(company[REVENUE_YTD_FIELD_NAME]), company[ACCOUNT_EXECUTIVE_FIELD_NAME] ); companiesToDisplay.push(row); @@ -50,4 +50,8 @@ export const makeTable = async () => { let reformatDate = new Date(date); return reformatDate.toLocaleTimeString([], { hour:"2-digit", minute:"2-digit" }); } + + function convertNumbers(number){ + return number.toLocaleString().replaceAll(".", " "); + } }; \ No newline at end of file From f3ad5df1206c2aa18ca3802cc4a408998308b555 Mon Sep 17 00:00:00 2001 From: Fabius Gasber Date: Mon, 8 Jan 2024 17:07:30 +0100 Subject: [PATCH 5/5] Feature request: make table look prettier --- styles.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/styles.css b/styles.css index abc9c53..91c3f69 100644 --- a/styles.css +++ b/styles.css @@ -16,7 +16,7 @@ table { By default, when you set borders on table elements, they will look pretty ugly. */ border-collapse: collapse; - border: 3px solid purple; + border: 3px solid lightblue; } thead th:nth-child(1) { @@ -42,4 +42,5 @@ th, td { /* nth-child is a pretty neat thing to use and is widely applicable in real-life projects. Reader is highly encouraged to do more reading on this. */ tr:nth-child(1) { font-weight: bold; + background-color: lightblue; } \ No newline at end of file