Skip to content

Commit d1653a9

Browse files
committed
fix: improve overflow handling for long assignment and course names and fix corner radii
1 parent 063b96c commit d1653a9

File tree

2 files changed

+47
-16
lines changed

2 files changed

+47
-16
lines changed

src/server/trmnl/screens/TodoListDisplay.tsx

Lines changed: 42 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const SectionHeader: FC<{ title: string; className: string }> = ({
9494
className,
9595
}) => (
9696
<div
97-
className={`w--full rounded--medium p--2 ${className}`}
97+
className={`w--full rounded--small rounded-t--medium p--2 ${className}`}
9898
style={{ borderRadius: '8px 8px 4px 4px' }}
9999
>
100100
<span className='title title--small text-stroke'>{title}</span>
@@ -108,7 +108,7 @@ const AssignmentCompletionBox: FC<{
108108
label: string;
109109
}> = ({ mode, className, count, label }) => (
110110
<div
111-
className={`flex ${mode === 'horizontal' ? 'flex--row' : 'w--full flex--col'} flex--center rounded--medium p--2 ${className}`}
111+
className={`flex ${mode === 'horizontal' ? 'flex--row' : 'w--full flex--col'} flex--center rounded-small p--2 ${className}`}
112112
style={{ borderRadius: '8px', flex: 1 }}
113113
>
114114
<p
@@ -217,25 +217,53 @@ const AssignmentItem: FC<{ assignment: AssignmentWithCourse }> = ({
217217
<div className='item'>
218218
<div className='meta'></div>
219219
<div className='content'>
220-
<span className='title title--small clamp--1'>
220+
<span
221+
className='title title--small clamp--1 w--full'
222+
style={{
223+
overflow: 'hidden',
224+
textOverflow: 'ellipsis',
225+
whiteSpace: 'nowrap',
226+
}}
227+
>
221228
{stripNonAscii(assignment.name)}
222229
</span>
223-
<p className='flex gap--small'>
230+
<div
231+
className='flex w--full gap--small'
232+
style={{ maxWidth: '100%' }}
233+
>
224234
{assignment.dueAt && (
225235
<span
226236
className='label label--small label--underline clamp--none'
227-
style={{ overflow: 'hidden', whiteSpace: 'nowrap' }}
237+
style={{ whiteSpace: 'nowrap' }}
228238
>
229239
{assignment.dueAt.toLocaleString()}
230240
</span>
231241
)}
232-
<span
233-
className='label label--small clamp--1'
234-
style={{ flexShrink: 999 }}
242+
<div
243+
style={{
244+
flexGrow: 1,
245+
isolation: 'isolate',
246+
minWidth: '0px',
247+
position: 'relative',
248+
}}
235249
>
236-
{stripNonAscii(assignment.course.name)}
237-
</span>
238-
</p>
250+
<p
251+
className='label label--small'
252+
style={{
253+
display: 'block',
254+
overflow: 'hidden',
255+
position: 'absolute',
256+
right: 0,
257+
textOverflow: 'ellipsis',
258+
top: 0,
259+
whiteSpace: 'nowrap',
260+
width: '100%',
261+
}}
262+
>
263+
{stripNonAscii(assignment.course.name)}
264+
</p>
265+
</div>
266+
</div>
239267
</div>
240268
</div>
241269
);
@@ -313,7 +341,7 @@ export const TodoListDisplay: FC<TodoListDisplayProps> = ({
313341

314342
return (
315343
<>
316-
<div className={`layout ${layout === 'full' ? 'p--0 pb--2' : ''}`}>
344+
<div className={`layout ${layout === 'full' ? '' : ''}`}>
317345
<div
318346
className={`flex ${layout === 'halfVertical' ? 'flex--col' : 'flex--row'} gap h--full w--full`}
319347
>
@@ -342,8 +370,8 @@ export const TodoListDisplay: FC<TodoListDisplayProps> = ({
342370
(section) => section.assignments.length > 0,
343371
).length > 0 ? (
344372
<div
345-
className={`gap flex ${layout === 'halfHorizontal' ? 'flex--row' : 'flex--col'} ${layout === 'halfVertical' ? 'w--full' : 'h--full'}`}
346-
style={{ flexGrow: 1 }}
373+
className={`${layout === 'halfHorizontal' ? 'grid--cols-3 grid' : 'gap flex flex--col'} ${layout === 'halfVertical' ? 'w--full' : 'h--full'}`}
374+
style={{ flexGrow: 1, maxWidth: '100%' }}
347375
>
348376
{sections
349377
.filter(

src/shared/pages/dev/ScreenPreview.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const STATIC_DATA = {
3636
description: '',
3737
dueAt: CREATE_DATE(60 * 24),
3838
id: 302,
39-
name: 'Unit 2 Quiz',
39+
name: 'Unit 2 Quiz With a Very Long Name to Test Overflow Handling',
4040
},
4141
'303': {
4242
courseId: 202,
@@ -101,7 +101,10 @@ const STATIC_DATA = {
101101
},
102102
},
103103
courses: {
104-
'201': { id: 201, name: 'English Literature B (A. Smith)' },
104+
'201': {
105+
id: 201,
106+
name: 'English Literature B With a Very Long Name (A. Smith)',
107+
},
105108
'202': { id: 202, name: 'User Interface Design (R. Lin)' },
106109
'203': { id: 203, name: 'Digital Art & Portfolio (M. Reyes)' },
107110
'204': { id: 204, name: 'Current Issues Seminar (L. Tran)' },

0 commit comments

Comments
 (0)