From 0e81e3543ecb9c12a2c8aee0e6a67a7b3f08a5e9 Mon Sep 17 00:00:00 2001 From: "Kalle (Sendou)" <38327916+Sendouc@users.noreply.github.com> Date: Wed, 25 Aug 2021 21:37:03 +0300 Subject: [PATCH] Order suggestions better & timestamps Closes #630 --- components/plus/Suggestion.tsx | 25 ++++++++++++------------- services/plus.ts | 7 +++---- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/components/plus/Suggestion.tsx b/components/plus/Suggestion.tsx index 3452f0dcb..0603ec206 100644 --- a/components/plus/Suggestion.tsx +++ b/components/plus/Suggestion.tsx @@ -5,6 +5,7 @@ import { FormErrorMessage, FormHelperText, FormLabel, + Text, Textarea, useToast, } from "@chakra-ui/react"; @@ -13,7 +14,6 @@ import { Trans } from "@lingui/macro"; import MyLink from "components/common/MyLink"; import SubText from "components/common/SubText"; import UserAvatar from "components/common/UserAvatar"; -import { CSSVariables } from "utils/CSSVariables"; import { useState } from "react"; import { useForm } from "react-hook-form"; import { Suggestions } from "services/plus"; @@ -70,29 +70,28 @@ const Suggestion = ({ - - {new Date(suggestion.createdAt).toLocaleString()} - - +{suggestion.tier} + +{suggestion.tier} "{suggestion.description}" -{" "} - + {getFullUsername(suggestion.suggesterUser)} + + {" "} + ({new Date(suggestion.createdAt).toLocaleString("en")}) + {suggestion.resuggestions?.map((resuggestion) => { return ( "{resuggestion.description}" -{" "} - + {getFullUsername(resuggestion.suggesterUser)} + + {" "} + ({new Date(resuggestion.createdAt).toLocaleString("en")}) + ); })} diff --git a/services/plus.ts b/services/plus.ts index d22542a8e..a2dc348fa 100644 --- a/services/plus.ts +++ b/services/plus.ts @@ -63,10 +63,9 @@ const getSuggestions = async () => { .filter((suggestion) => !suggestion.isResuggestion) .map((suggestion) => ({ ...suggestion, - resuggestions: - suggestionDescriptions[ - suggestion.suggestedUser.id + "_" + suggestion.tier - ], + resuggestions: suggestionDescriptions[ + suggestion.suggestedUser.id + "_" + suggestion.tier + ]?.sort((a, b) => a.createdAt.getTime() - b.createdAt.getTime()), })); };