add wordpress migration
This commit is contained in:
@ -4,15 +4,19 @@ import { OrganizerList } from "./OrganizerList";
|
||||
import Icon from "../general/Icon";
|
||||
import { DateList } from "./DateList";
|
||||
|
||||
function formatPrice(price: number): string {
|
||||
function formatPrice(price: number | string): string {
|
||||
if (price === null) {
|
||||
// should not happen
|
||||
return "?";
|
||||
}
|
||||
if (price === 0) {
|
||||
const asNumber = Number(price);
|
||||
if (isNaN(asNumber)) {
|
||||
return price;
|
||||
}
|
||||
if (asNumber === 0) {
|
||||
return "Gratis";
|
||||
}
|
||||
return `${price} kr`;
|
||||
return `${asNumber} kr`;
|
||||
}
|
||||
|
||||
export const EventDetails = ({ event }: { event: EventFragment }) => {
|
||||
@ -29,19 +33,19 @@ export const EventDetails = ({ event }: { event: EventFragment }) => {
|
||||
<span>Gratis</span>
|
||||
</li>
|
||||
)}
|
||||
{typeof event.priceRegular === "number" && (
|
||||
{event.priceRegular && (
|
||||
<li className={styles.priceItem}>
|
||||
<span className={styles.priceLabel}>Ordinær</span>{" "}
|
||||
{formatPrice(event.priceRegular)}
|
||||
</li>
|
||||
)}
|
||||
{typeof event.priceStudent === "number" && (
|
||||
{event.priceStudent && (
|
||||
<li className={styles.priceItem}>
|
||||
<span className={styles.priceLabel}>Student</span>{" "}
|
||||
{formatPrice(event.priceStudent)}
|
||||
</li>
|
||||
)}
|
||||
{typeof event.priceMember === "number" && (
|
||||
{event.priceMember && (
|
||||
<li className={styles.priceItem}>
|
||||
<span className={styles.priceLabel}>Medlem</span>{" "}
|
||||
{formatPrice(event.priceMember)}
|
||||
@ -49,7 +53,7 @@ export const EventDetails = ({ event }: { event: EventFragment }) => {
|
||||
)}
|
||||
</ul>
|
||||
</div>
|
||||
{event.organizers && (
|
||||
{event.organizers.length !== 0 && (
|
||||
<div>
|
||||
<div className="suphead">Arrangeres av</div>{" "}
|
||||
<OrganizerList event={event} />
|
||||
|
@ -27,7 +27,7 @@ export const VenueInfo = ({ venue }: { venue: VenueFragment }) => {
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Bruk</th>
|
||||
<td>TODO</td>
|
||||
<td>{venue.usedFor}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Bar</th>
|
||||
@ -47,10 +47,16 @@ export const VenueInfo = ({ venue }: { venue: VenueFragment }) => {
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<a href="#" target="_blank" className="button secondary">
|
||||
<span>Tekniske spesifikasjoner</span>
|
||||
<Icon type="doc" />
|
||||
</a>
|
||||
{venue.techSpecsUrl && (
|
||||
<a
|
||||
href={venue.techSpecsUrl}
|
||||
target="_blank"
|
||||
className="button secondary"
|
||||
>
|
||||
<span>Tekniske spesifikasjoner</span>
|
||||
<Icon type="doc" />
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
@ -6,6 +6,17 @@ import { Image } from "@/components/general/Image";
|
||||
export const VenueItem = ({ venue }: { venue: VenueFragment }) => {
|
||||
const featuredImage: any = venue.featuredImage;
|
||||
|
||||
const { capacitySitting, capacityStanding, usedFor } = venue;
|
||||
let capacity = null;
|
||||
if (
|
||||
!isNaN(capacitySitting) &&
|
||||
capacitySitting &&
|
||||
!isNaN(capacityStanding) &&
|
||||
capacityStanding
|
||||
) {
|
||||
capacity = `${capacitySitting}—${capacityStanding}`;
|
||||
}
|
||||
|
||||
return (
|
||||
<li className={`${styles.venueItem} linkItem`}>
|
||||
<div className={styles.image}>
|
||||
@ -21,13 +32,15 @@ export const VenueItem = ({ venue }: { venue: VenueFragment }) => {
|
||||
</div>
|
||||
<div className={styles.text}>
|
||||
<h1 className={styles.title}>{venue.title}</h1>
|
||||
<div className={styles.details}>
|
||||
<strong>Passer for:</strong>
|
||||
<ul>
|
||||
<li>50—115 personer</li>
|
||||
<li>Konsert, foredrag, fest, debatt, teater, filmvisning</li>
|
||||
</ul>
|
||||
</div>
|
||||
{(capacity || usedFor) && (
|
||||
<div className={styles.details}>
|
||||
<strong>Passer for:</strong>
|
||||
<ul>
|
||||
{capacity && <li>{capacity} personer</li>}
|
||||
{usedFor && <li>{usedFor}</li>}
|
||||
</ul>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<Link href={`/lokaler/${venue.slug}`} className="hiddenLink">
|
||||
Mer om lokalet {venue.title}
|
||||
|
Reference in New Issue
Block a user