-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat-larivaar-assist-vishraams (#1723)
adds new larivaar-assist vishraams
- Loading branch information
Showing
22 changed files
with
273 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,46 @@ | ||
import React from 'react'; | ||
import CrossIcon from '../Icons/Times'; | ||
import { Link } from 'react-router-dom'; | ||
import { useFetchData } from '@/hooks'; | ||
|
||
const Banner = () => { | ||
const url = "https://sttm.s3.us-west-2.amazonaws.com/urgent-message.json"; | ||
|
||
const { | ||
isFetchingData: isFetchingBannerMessage, | ||
data: bannerMessage, | ||
} = useFetchData(url); | ||
|
||
const lastSeen = sessionStorage.getItem("bannerMessage"); | ||
const updateLastSeen = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => { | ||
e.currentTarget.parentElement?.remove(); | ||
sessionStorage.setItem("bannerMessage", "seen"); | ||
}; | ||
|
||
if (isFetchingBannerMessage || !bannerMessage.active || lastSeen === 'seen') { | ||
return null | ||
} | ||
type Props = { | ||
banner: { | ||
type: string; | ||
message: string; | ||
label?: string; | ||
link?: string; | ||
classes?: { | ||
notification?: string; | ||
} | ||
}, | ||
onCrossIconClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void; | ||
} | ||
|
||
const Banner = (props: Props) => { | ||
return ( | ||
<div className="banner-container"> | ||
<div className={`notification type-${bannerMessage.data.type}`}> | ||
<div className={`notification type-${props.banner.type} ${props.banner.classes?.notification}`}> | ||
<div className='banner-text-container'> | ||
<div className="banner-text"> | ||
<span className="banner-title">{bannerMessage.data.message}</span> | ||
<span className="banner-title">{props.banner.message}</span> | ||
</div> | ||
{bannerMessage.data?.label && | ||
<button className={`banner-link-button type-${bannerMessage.data.type}`}> | ||
{props.banner.label && | ||
<button className={`banner-link-button type-${props.banner.type}`}> | ||
<Link | ||
className="banner-link-button-text" | ||
to={{ pathname: `https://${bannerMessage.data?.link}` }} | ||
to={{ pathname: `https://${props.banner.link}` }} | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
{bannerMessage.data?.label} | ||
{props.banner.label} | ||
</Link> | ||
</button>} | ||
</div> | ||
<button className="banner-cross-bg" onClick={(e) => updateLastSeen(e)}> | ||
<button className="banner-cross-bg" onClick={(e) => props.onCrossIconClick?.(e)}> | ||
<CrossIcon className="banner-cross" /> | ||
</button> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default Banner; | ||
export default Banner; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from 'react'; | ||
import { useFetchData } from '@/hooks'; | ||
import Banner from './Banner'; | ||
|
||
const BASE_URL = "https://sttm.s3.us-west-2.amazonaws.com/urgent-message.json"; | ||
|
||
const MainPageBanner = () => { | ||
|
||
const { | ||
isFetchingData: isFetchingBannerMessage, | ||
data: bannerData, | ||
} = useFetchData(BASE_URL); | ||
|
||
const lastSeen = sessionStorage.getItem("bannerMessage"); | ||
const updateLastSeen = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => { | ||
e.currentTarget.parentElement?.remove(); | ||
sessionStorage.setItem("bannerMessage", "seen"); | ||
}; | ||
|
||
if (isFetchingBannerMessage || !bannerData.active || !bannerData.data || lastSeen === 'seen') { | ||
return null | ||
} | ||
|
||
return ( | ||
<Banner | ||
banner={bannerData.data} | ||
onCrossIconClick={updateLastSeen} | ||
/> | ||
) | ||
} | ||
|
||
export default MainPageBanner; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,15 @@ | ||
import React from 'react'; | ||
|
||
interface INotificationProps { | ||
interface Props { | ||
title: string, | ||
message: string | ||
} | ||
|
||
export const Notification: React.FC<INotificationProps> = ({ | ||
title, | ||
message | ||
}) => { | ||
export const Notification = (props: Props) => { | ||
return ( | ||
<div className="toastNotification"> | ||
<h3 className="toastNotificationTitle">{title}</h3> | ||
<span className="toastNotificationContent">{message}</span> | ||
<h3 className="toastNotificationTitle">{props.title}</h3> | ||
<span className="toastNotificationContent">{props.message}</span> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.