Skip to content

Commit f6c29a5

Browse files
committed
modify notification banners
1 parent 77e7f62 commit f6c29a5

4 files changed

Lines changed: 57 additions & 26 deletions

File tree

content/_data/constants.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,11 @@ cookie_consent:
104104
title: CSC Quantum Computing docs.
105105
href: https://docs.csc.fi/computing/quantum-computing/overview/
106106

107-
resource_estimator:
108-
text: |-
109-
For estimating the runtime of a quantum job try out the
110-
link:
111-
title: FiQCI QPU resource estimator
112-
href: https://fiqci.fi/resource-estimator
107+
alerts:
108+
- text: |-
109+
For estimating the runtime of a quantum job try out the FiQCI QPU resource estimator.
110+
type: info
111+
link: "https://fiqci.fi/resource-estimator"
113112
114113
quantum_resources:
115114
- name: Aalto Q20
@@ -252,6 +251,10 @@ cookie_consent:
252251
title: here
253252
href: https://www.lumi-supercomputer.eu/lumi-service-status/
254253
alerts: # Each alert renders as its own banner. type can be info, warning, or error
254+
- text: |-
255+
For estimating the runtime of a quantum job try out the FiQCI QPU resource estimator.
256+
type: info
257+
link: "https://fiqci.fi/resource-estimator"
255258
- text: |-
256259
Aalto Q20 access is coming soon!
257260
type: info

src/components/AlertBanner.jsx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { mdiInformation, mdiClose, mdiAlert, mdiChevronRight } from '@mdi/js';
2+
import { CCard, CCardTitle, CCardContent, CIcon, CButton, CSelect } from '@cscfi/csc-ui-react';
3+
4+
const ALERT_STYLES = {
5+
warning: { bg: 'bg-orange-200', icon: mdiAlert },
6+
error: { bg: 'bg-red-200', icon: mdiClose },
7+
info: { bg: 'bg-sky-200', icon: mdiInformation },
8+
};
9+
10+
export const AlertBanner = ({ type, text, link }) => {
11+
const { bg, icon } = ALERT_STYLES[type?.toLowerCase()] ?? ALERT_STYLES.info;
12+
const content = (
13+
<>
14+
<CIcon key={icon} path={icon} />
15+
<p className='text-[16px]'>
16+
{type ? text : 'Loading...'}
17+
</p>
18+
{link ? <CIcon path={mdiChevronRight} className='ml-auto' /> : null}
19+
</>
20+
);
21+
22+
if (link) {
23+
return (
24+
<a href={link} className={`flex flex-row gap-4 w-full p-3 rounded-md ${bg} items-start sm:items-center cursor-pointer hover:shadow-md hover:opacity-90 transition-all`}>
25+
{content}
26+
</a>
27+
);
28+
}
29+
30+
return (
31+
<div className={`flex flex-row gap-4 w-full p-3 rounded-md ${bg} items-start sm:items-center`}>
32+
{content}
33+
</div>
34+
);
35+
};

src/components/GetAccess.jsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { useEffect } from "react";
22
import { prependBaseURL } from '../utils/url';
3+
import { AlertBanner } from './AlertBanner.jsx';
34

45
const ResourceCard = ({ resource }) => {
56
return (
@@ -47,6 +48,8 @@ export const GetAccess = props => {
4748
const emulation_resources = props?.emulation_resources
4849
const getting_started = props?.getting_started
4950

51+
const alerts = props.alerts ?? (props.alert ? [props.alert] : []);
52+
5053
const resource_estimator = props?.resource_estimator
5154

5255
useEffect(() => {
@@ -79,10 +82,17 @@ export const GetAccess = props => {
7982
<p className="pt-4">{getting_started?.text} <a className="text-base text-sky-800 hover:underline" href={getting_started?.link.href}>{getting_started?.link.title}</a></p>
8083

8184
<p className="pt-4">Please see status of services from <a className="text-base text-sky-800 hover:underline" href={prependBaseURL("/status")}>Status</a> -page.</p>
82-
83-
<p className="pt-4"> {resource_estimator?.text} <a className="text-sky-800 hover:underline" href={resource_estimator?.link.href}>{resource_estimator?.link.title}</a>. </p>
8485
</div>
8586

87+
{alerts.length > 0 && (
88+
<div className='flex flex-col gap-3'>
89+
{alerts.map((alert, index) => (
90+
<AlertBanner key={index} {...alert} />
91+
))}
92+
</div>
93+
)}
94+
95+
8696
<ResourceList id={"quantum"} title={"Quantum computer resources"} resources={quantum_resources} />
8797

8898
<ResourceList id={"super"} title={"Supercomputer resources"} resources={supercomputer_resources} />

src/components/ServiceStatus.jsx

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,7 @@ import { CCard, CCardTitle, CCardContent, CIcon, CButton, CSelect } from '@cscfi
77
import { StatusModal } from './StatusModal/StatusModal';
88
import { BookingModal } from './bookingCalendar.jsx';
99
import { API_BASE_URL } from '../config/api.js';
10-
11-
const ALERT_STYLES = {
12-
warning: { bg: 'bg-orange-200', icon: mdiAlert },
13-
error: { bg: 'bg-red-200', icon: mdiClose },
14-
info: { bg: 'bg-sky-200', icon: mdiInformation },
15-
};
16-
17-
const AlertBanner = ({ type, text }) => {
18-
const { bg, icon } = ALERT_STYLES[type?.toLowerCase()] ?? ALERT_STYLES.info;
19-
return (
20-
<div className={`flex flex-row gap-4 w-full p-3 rounded-md ${bg} items-start sm:items-center`}>
21-
<CIcon key={icon} path={icon} />
22-
<p className='text-[16px]'>
23-
{type ? text : 'Loading...'}
24-
</p>
25-
</div>
26-
);
27-
};
10+
import { AlertBanner } from './AlertBanner.jsx';
2811

2912
const StatusCard = (props) => {
3013
const isOnline = props.health;

0 commit comments

Comments
 (0)