Sasha commited on
Commit
981287f
·
1 Parent(s): 0b30711

feat: adjust center group threshold to 250 for chat words

Browse files
Files changed (1) hide show
  1. client/src/App.jsx +6 -5
client/src/App.jsx CHANGED
@@ -1171,13 +1171,14 @@ export default function App() {
1171
  const fontScale = isMobile ? 0.45 : 1.0;
1172
  const remToPx = 16;
1173
 
1174
- // Identify center group: words with count within 500 of the max count,
1175
- // but ONLY if the top count is >= 500. Also cap center group size to at most 3 words.
 
1176
  const centerGroupWords = currentWordsList.filter((w, idx) =>
1177
- idx === 0 || (maxCount >= 500 && (maxCount - w.word_count) < 500 && idx < 3)
1178
  );
1179
  const otherWordsList = currentWordsList.filter((w, idx) =>
1180
- !(idx === 0 || (maxCount >= 500 && (maxCount - w.word_count) < 500 && idx < 3))
1181
  );
1182
 
1183
  const maxOtherCount = otherWordsList.length > 0 ? Math.max(...otherWordsList.map(x => x.word_count)) : 1;
@@ -1203,7 +1204,7 @@ export default function App() {
1203
 
1204
  for (let i = 0; i < currentWordsList.length; i++) {
1205
  const w = currentWordsList[i];
1206
- const isCenterGroup = i === 0 || (maxCount >= 500 && (maxCount - w.word_count) < 500 && i < 3);
1207
 
1208
  let fontSize;
1209
  let fontWeight;
 
1171
  const fontScale = isMobile ? 0.45 : 1.0;
1172
  const remToPx = 16;
1173
 
1174
+ const centerGroupThreshold = wordType === 'chat' ? 250 : 500;
1175
+ // Identify center group: words with count within threshold of the max count,
1176
+ // but ONLY if the top count is >= threshold. Also cap center group size to at most 3 words.
1177
  const centerGroupWords = currentWordsList.filter((w, idx) =>
1178
+ idx === 0 || (maxCount >= centerGroupThreshold && (maxCount - w.word_count) < centerGroupThreshold && idx < 3)
1179
  );
1180
  const otherWordsList = currentWordsList.filter((w, idx) =>
1181
+ !(idx === 0 || (maxCount >= centerGroupThreshold && (maxCount - w.word_count) < centerGroupThreshold && idx < 3))
1182
  );
1183
 
1184
  const maxOtherCount = otherWordsList.length > 0 ? Math.max(...otherWordsList.map(x => x.word_count)) : 1;
 
1204
 
1205
  for (let i = 0; i < currentWordsList.length; i++) {
1206
  const w = currentWordsList[i];
1207
+ const isCenterGroup = i === 0 || (maxCount >= centerGroupThreshold && (maxCount - w.word_count) < centerGroupThreshold && i < 3);
1208
 
1209
  let fontSize;
1210
  let fontWeight;