From 3f4832965ddb64726c8a9e10b1942d4e6d05211c Mon Sep 17 00:00:00 2001 From: Lim Chee Aun <cheeaun@gmail.com> Date: Tue, 5 Mar 2024 23:30:12 +0800 Subject: [PATCH] Extracting stuff for now --- src/pages/catchup.jsx | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/src/pages/catchup.jsx b/src/pages/catchup.jsx index ae76d28e..72081c0d 100644 --- a/src/pages/catchup.jsx +++ b/src/pages/catchup.jsx @@ -61,6 +61,22 @@ const RANGES = [ { label: 'beyond 12 hours', value: 13 }, ]; +const FILTER_LABELS = [ + 'Original', + 'Replies', + 'Boosts', + 'Followed tags', + 'Groups', + 'Filtered', +]; +const FILTER_SORTS = [ + 'createdAt', + 'repliesCount', + 'favouritesCount', + 'reblogsCount', + 'density', +]; +const FILTER_GROUPS = [null, 'account']; const FILTER_VALUES = { Filtered: 'filtered', Groups: 'group', @@ -1040,14 +1056,7 @@ function Catchup() { /> All <span class="count">{posts.length}</span> </label> - {[ - 'Original', - 'Replies', - 'Boosts', - 'Followed tags', - 'Groups', - 'Filtered', - ].map( + {FILTER_LABELS.map( (label) => !!filterCounts[label] && ( <label @@ -1135,14 +1144,7 @@ function Catchup() { <div class="catchup-filters"> <span class="filter-label">Sort</span>{' '} <fieldset class="radio-field-group"> - {[ - 'createdAt', - 'repliesCount', - 'favouritesCount', - 'reblogsCount', - 'density', - // 'account', - ].map((key) => ( + {FILTER_SORTS.map((key) => ( <label class="filter-sort" key={key} @@ -1198,7 +1200,7 @@ function Catchup() { </fieldset> */} <span class="filter-label">Group</span>{' '} <fieldset class="radio-field-group"> - {[null, 'account'].map((key) => ( + {FILTER_GROUPS.map((key) => ( <label class="filter-group" key={key || 'none'}> <input type="radio"