resolve name spacing bug
Authored by
mfwolffe <wolffemf@dukes.jmu.edu>
- SHA
9db9832b7088216e444cb46ee3b715034dc0ce64- Parents
-
1512361 - Tree
8fcd7ed
9db9832
9db9832b7088216e444cb46ee3b715034dc0ce641512361
8fcd7ed| Status | File | + | - |
|---|---|---|---|
| M |
app/memorial/conflict/[id]/page.tsx
|
8 | 3 |
| M |
app/memorial/page.tsx
|
3 | 1 |
| M |
app/memorial/person/[id]/page.tsx
|
7 | 3 |
| M |
app/memorial/search/page.tsx
|
7 | 3 |
app/memorial/conflict/[id]/page.tsxmodified@@ -144,9 +144,14 @@ useEffect(() => { | ||
| 144 | 144 | className="block p-6 border-2 border-gray-200 rounded-lg hover:border-vmi-gold hover:bg-vmi-light-gold transition-all duration-200 group" |
| 145 | 145 | > |
| 146 | 146 | <h3 className="text-xl font-bold text-gray-800 group-hover:text-vmi-red transition-colors mb-2 flex items-center gap-2"> |
| 147 | - {person.full_display_name ? | |
| 148 | - person.full_display_name.replace(person.rank + ' ', '').replace(person.rank + ', ', '') | |
| 149 | - : person.display_name.replace(person.rank + ' ', '').replace(person.rank + ', ', '')} | |
| 147 | + {(() => { | |
| 148 | + const name = person.full_display_name || person.display_name; | |
| 149 | + // Only remove rank if it exists | |
| 150 | + if (person.rank) { | |
| 151 | + return name.replace(person.rank + ' ', '').replace(person.rank + ', ', ''); | |
| 152 | + } | |
| 153 | + return name; | |
| 154 | + })()} | |
| 150 | 155 | {person.pdf_key && <DocumentIcon className="flex-shrink-0" />} |
| 151 | 156 | </h3> |
| 152 | 157 | {person.rank && ( |
app/memorial/page.tsxmodified@@ -176,7 +176,9 @@ export default function MemorialIndexPage() { | ||
| 176 | 176 | className="block p-4 border border-gray-200 rounded hover:border-vmi-gold hover:bg-vmi-light-gold transition-all duration-200 group" |
| 177 | 177 | > |
| 178 | 178 | <h3 className="font-bold text-gray-800 group-hover:text-vmi-red transition-colors flex items-center gap-2"> |
| 179 | - {person.display_name.replace(person.rank + ' ', '').replace(person.rank + ', ', '')} | |
| 179 | + {person.rank | |
| 180 | + ? person.display_name.replace(person.rank + ' ', '').replace(person.rank + ', ', '') | |
| 181 | + : person.display_name} | |
| 180 | 182 | {person.pdf_key && <DocumentIcon className="flex-shrink-0" />} |
| 181 | 183 | </h3> |
| 182 | 184 | {person.rank && ( |
app/memorial/person/[id]/page.tsxmodified@@ -85,9 +85,13 @@ export default function PersonPage() { | ||
| 85 | 85 | ); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - const displayName = person.full_display_name ? | |
| 89 | - person.full_display_name.replace(person.rank + ' ', '').replace(person.rank + ', ', '') | |
| 90 | - : person.display_name; | |
| 88 | + const displayName = (() => { | |
| 89 | + const name = person.full_display_name || person.display_name; | |
| 90 | + if (person.rank && person.full_display_name) { | |
| 91 | + return name.replace(person.rank + ' ', '').replace(person.rank + ', ', ''); | |
| 92 | + } | |
| 93 | + return person.full_display_name ? name : person.display_name; | |
| 94 | + })(); | |
| 91 | 95 | |
| 92 | 96 | return ( |
| 93 | 97 | <div className="min-h-screen bg-vmi-cream"> |
app/memorial/search/page.tsxmodified@@ -283,9 +283,13 @@ export default function MemorialSearchPage() { | ||
| 283 | 283 | <div className="grid grid-cols-1 md:grid-cols-3 gap-4"> |
| 284 | 284 | <div> |
| 285 | 285 | <h3 className="text-xl font-bold text-gray-800 group-hover:text-vmi-red transition-colors flex items-center gap-2"> |
| 286 | - {person.full_display_name ? | |
| 287 | - person.full_display_name.replace(person.rank + ' ', '').replace(person.rank + ', ', '') | |
| 288 | - : person.display_name} | |
| 286 | + {(() => { | |
| 287 | + const name = person.full_display_name || person.display_name; | |
| 288 | + if (person.rank && person.full_display_name) { | |
| 289 | + return name.replace(person.rank + ' ', '').replace(person.rank + ', ', ''); | |
| 290 | + } | |
| 291 | + return person.full_display_name ? name : person.display_name; | |
| 292 | + })()} | |
| 289 | 293 | {person.pdf_key && <DocumentIcon className="flex-shrink-0" />} |
| 290 | 294 | </h3> |
| 291 | 295 | {person.rank && ( |