Skip to content

Commit 4e61705

Browse files
Merge pull request #18 from StreetSupport/staging
Merge staging into main
2 parents 38d6b43 + 43dc83b commit 4e61705

File tree

14 files changed

+54
-135
lines changed

14 files changed

+54
-135
lines changed

src/app/banners/[id]/edit/page.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ function transformBannerToFormData(banner: IBanner): IBannerFormData {
3838
BadgeText: banner.BadgeText || '',
3939
StartDate: banner.StartDate ? new Date(banner.StartDate) : undefined,
4040
EndDate: banner.EndDate ? new Date(banner.EndDate) : undefined,
41-
ShowDates: banner.ShowDates || false,
4241

4342
// Transform media fields - keep existing IMediaAsset objects as-is
4443
Logo: banner.Logo || null,

src/app/banners/[id]/page.tsx

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -303,21 +303,17 @@ export default function BannerViewPage() {
303303
</dd>
304304
</div>
305305

306-
{banner.ShowDates && (
306+
{banner.StartDate && banner.EndDate && (
307307
<>
308-
{banner.StartDate && (
309-
<div>
310-
<dt className="text-small font-medium text-brand-k">Start Date</dt>
311-
<dd className="text-base text-brand-l">{formatDate(banner.StartDate)}</dd>
312-
</div>
313-
)}
308+
<div>
309+
<dt className="text-small font-medium text-brand-k">Start Date</dt>
310+
<dd className="text-base text-brand-l">{formatDate(banner.StartDate)}</dd>
311+
</div>
314312

315-
{banner.EndDate && (
316-
<div>
317-
<dt className="text-small font-medium text-brand-k">End Date</dt>
318-
<dd className="text-base text-brand-l">{formatDate(banner.EndDate)}</dd>
319-
</div>
320-
)}
313+
<div>
314+
<dt className="text-small font-medium text-brand-k">End Date</dt>
315+
<dd className="text-base text-brand-l">{formatDate(banner.EndDate)}</dd>
316+
</div>
321317
</>
322318
)}
323319

src/app/swep-banners/[locationSlug]/page.tsx

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { useAuthorization } from '@/hooks/useAuthorization';
77
import { ROLES } from '@/constants/roles';
88
import { ISwepBanner } from '@/types/swep-banners/ISwepBanner';
99
import { authenticatedFetch } from '@/utils/authenticatedFetch';
10-
import { formatSwepActivePeriod, parseSwepBody } from '@/utils/swep';
1110
import { ErrorState } from '@/components/ui/ErrorState';
1211
import { errorToast } from '@/utils/toast';
1312
import { LoadingSpinner } from '@/components/ui/LoadingSpinner';
@@ -91,30 +90,40 @@ export default function SwepViewPage() {
9190
);
9291
}
9392

94-
const activePeriodText = formatSwepActivePeriod(swepData);
95-
const parsedBody = parseSwepBody(swepData.Body);
96-
9793
return (
9894
<>
9995
{/* SWEP Header Section - Full width matching public website */}
100-
<div className="bg-red-50 border-b-4 border-brand-g py-12">
101-
<div className="max-w-6xl mx-auto px-6">
102-
<div className="flex items-center gap-3 mb-4">
103-
<div className="w-6 h-6 bg-brand-g rounded-full flex items-center justify-center flex-shrink-0">
104-
<div className="w-3 h-3 bg-white rounded-full"></div>
96+
{!swepData.IsActive && (
97+
<div className="bg-brand-d py-12">
98+
<div className="max-w-6xl mx-auto px-6 text-center">
99+
<h2 className="text-2xl font-bold text-brand-l mb-4">
100+
Severe Weather Emergency Accommodation is not currently active in {swepData.LocationName}
101+
</h2>
102+
<p className="text-brand-k mb-4">
103+
This page provides information about emergency accommodation during severe weather. The service is activated when temperatures drop below freezing.
104+
</p>
105+
<p className="text-brand-k mb-6">If you need help right now, please visit:</p>
106+
<div className="flex flex-col sm:flex-row gap-4 justify-center">
107+
<a
108+
href={`${process.env.NEXT_PUBLIC_WEB_URL}/${swepData.LocationSlug}/advice/`}
109+
className="inline-flex items-center justify-center px-6 py-3 bg-brand-g text-white font-semibold rounded-md hover:bg-opacity-90 transition-colors"
110+
target="_blank"
111+
rel="noopener noreferrer"
112+
>
113+
See emergency advice
114+
</a>
115+
<a
116+
href={`${process.env.NEXT_PUBLIC_WEB_URL}/find-help/`}
117+
className="inline-flex items-center justify-center px-6 py-3 bg-brand-e text-brand-l font-semibold rounded-md hover:bg-opacity-90 transition-colors"
118+
target="_blank"
119+
rel="noopener noreferrer"
120+
>
121+
Find Help
122+
</a>
105123
</div>
106-
<h1 className="text-3xl font-bold text-red-800 mb-0">
107-
{swepData.Title}
108-
</h1>
109-
</div>
110-
<p className="text-lg text-red-700 mb-4">
111-
{activePeriodText}
112-
</p>
113-
<div className="bg-brand-g text-white px-4 py-2 rounded-md inline-block">
114-
<strong>Emergency Support Available</strong>
115124
</div>
116125
</div>
117-
</div>
126+
)}
118127

119128
{/* Content Section - matching public website */}
120129
<section className="py-12">
@@ -133,7 +142,7 @@ export default function SwepViewPage() {
133142
{/* Body content with prose styling */}
134143
<div
135144
className="prose prose-lg max-w-none mb-12"
136-
dangerouslySetInnerHTML={{ __html: parsedBody }}
145+
dangerouslySetInnerHTML={{ __html: swepData.Body }}
137146
/>
138147

139148
{/* Emergency Contacts Section */}

src/components/banners/BannerEditor.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ export function BannerEditor({ initialData, onDataChange, onSave, saving = false
185185
},
186186
StartDate: undefined,
187187
EndDate: undefined,
188-
ShowDates: false,
189188
_id: '',
190189
};
191190
};

src/components/banners/BannerPreview.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ function transformToPublicFormat(data: IBannerFormData) {
100100
},
101101
textColour: data.TextColour?.toLowerCase() || 'white',
102102
layoutStyle: data.LayoutStyle?.toLowerCase() || LayoutStyle.SPLIT,
103-
showDates: data.ShowDates || false,
104103
startDate: data.StartDate,
105104
endDate: data.EndDate,
106105
badgeText: data.BadgeText || ''

src/components/banners/GivingCampaignBanner.tsx

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ interface GivingCampaignBannerProps {
136136
background: { type: string; value: string; overlay?: { colour: string; opacity: number } };
137137
textColour: string;
138138
layoutStyle: string;
139-
showDates?: boolean;
140139
startDate?: Date;
141140
endDate?: Date;
142141
badgeText?: string;
@@ -156,7 +155,6 @@ export const GivingCampaignBanner: React.FC<GivingCampaignBannerProps> = ({
156155
background,
157156
textColour,
158157
layoutStyle,
159-
showDates,
160158
startDate,
161159
endDate,
162160
badgeText,
@@ -326,19 +324,11 @@ export const GivingCampaignBanner: React.FC<GivingCampaignBannerProps> = ({
326324
))}
327325
</div>
328326
{/* Date range */}
329-
{showDates && (startDate || endDate) && (
327+
{startDate && endDate && (
330328
<div className="mt-6 text-sm opacity-70">
331-
{startDate && endDate && (
332-
<p>
333-
{new Date(startDate).toLocaleDateString('en-GB')} - {new Date(endDate).toLocaleDateString('en-GB')}
334-
</p>
335-
)}
336-
{startDate && !endDate && (
337-
<p>From {new Date(startDate).toLocaleDateString('en-GB')}</p>
338-
)}
339-
{!startDate && endDate && (
340-
<p>Until {new Date(endDate).toLocaleDateString('en-GB')}</p>
341-
)}
329+
<p>
330+
{new Date(startDate).toLocaleDateString('en-GB')} - {new Date(endDate).toLocaleDateString('en-GB')}
331+
</p>
342332
</div>
343333
)}
344334
</div>

src/components/banners/PartnershipCharterBanner.tsx

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ interface PartnershipCharterBannerProps {
138138
background: { type: string; value: string; overlay?: { colour: string; opacity: number } };
139139
textColour: string;
140140
layoutStyle: string;
141-
showDates?: boolean;
142141
startDate?: Date;
143142
endDate?: Date;
144143
badgeText?: string;
@@ -158,7 +157,6 @@ export const PartnershipCharterBanner: React.FC<PartnershipCharterBannerProps> =
158157
background,
159158
textColour,
160159
layoutStyle,
161-
showDates,
162160
startDate,
163161
endDate,
164162
badgeText,
@@ -351,19 +349,11 @@ export const PartnershipCharterBanner: React.FC<PartnershipCharterBannerProps> =
351349
</div>
352350
)}
353351
{/* Date range */}
354-
{showDates && (startDate || endDate) && (
352+
{startDate && endDate && (
355353
<div className="mt-6 text-sm opacity-70 text-left">
356-
{startDate && endDate && (
357-
<p>
358-
{new Date(startDate).toLocaleDateString('en-GB')} - {new Date(endDate).toLocaleDateString('en-GB')}
359-
</p>
360-
)}
361-
{startDate && !endDate && (
362-
<p>From {new Date(startDate).toLocaleDateString('en-GB')}</p>
363-
)}
364-
{!startDate && endDate && (
365-
<p>Until {new Date(endDate).toLocaleDateString('en-GB')}</p>
366-
)}
354+
<p>
355+
{new Date(startDate).toLocaleDateString('en-GB')} - {new Date(endDate).toLocaleDateString('en-GB')}
356+
</p>
367357
</div>
368358
)}
369359
</div>

src/components/banners/ResourceProjectBanner.tsx

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ interface ResourceProjectBannerProps {
186186
background: { type: string; value: string; overlay?: { colour: string; opacity: number } };
187187
textColour: string;
188188
layoutStyle: string;
189-
showDates?: boolean;
190189
startDate?: Date;
191190
endDate?: Date;
192191
badgeText?: string;
@@ -208,7 +207,6 @@ export const ResourceProjectBanner: React.FC<ResourceProjectBannerProps> = ({
208207
background,
209208
textColour,
210209
layoutStyle,
211-
showDates,
212210
startDate,
213211
endDate,
214212
badgeText,
@@ -439,19 +437,11 @@ export const ResourceProjectBanner: React.FC<ResourceProjectBannerProps> = ({
439437
)}
440438

441439
{/* Date range */}
442-
{showDates && (startDate || endDate) && (
440+
{startDate && endDate && (
443441
<div className="mt-6 text-sm opacity-70 text-left">
444-
{startDate && endDate && (
445-
<p>
446-
Available: {new Date(startDate).toLocaleDateString('en-GB')} - {new Date(endDate).toLocaleDateString('en-GB')}
447-
</p>
448-
)}
449-
{startDate && !endDate && (
450-
<p>Available from {new Date(startDate).toLocaleDateString('en-GB')}</p>
451-
)}
452-
{!startDate && endDate && (
453-
<p>Available until {new Date(endDate).toLocaleDateString('en-GB')}</p>
454-
)}
442+
<p>
443+
Available: {new Date(startDate).toLocaleDateString('en-GB')} - {new Date(endDate).toLocaleDateString('en-GB')}
444+
</p>
455445
</div>
456446
)}
457447
</div>

src/components/location-logos/LocationLogoForm.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,9 @@ export default function LocationLogoForm({
153153

154154
try {
155155
const formDataToSend = new FormData();
156-
formDataToSend.append('Name', formData.Name);
156+
if (formData.Name) {
157+
formDataToSend.append('Name', formData.Name);
158+
}
157159
formDataToSend.append('DisplayName', formData.DisplayName);
158160
formDataToSend.append('LocationSlug', formData.LocationSlug);
159161
formDataToSend.append('LocationName', formData.LocationName);

src/schemas/bannerSchema.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ export function transformErrorPath(path: string): string {
8787
'Logo': 'Logo',
8888
'BackgroundImage': 'Background Image',
8989
'IsActive': 'Active Status',
90-
'ShowDates': 'Show Dates',
9190
'StartDate': 'Start Date',
9291
'EndDate': 'End Date',
9392
'BadgeText': 'Badge Text',

0 commit comments

Comments
 (0)