-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dependabot/pip/backend/django-4.2.3
- Loading branch information
Showing
15 changed files
with
235 additions
and
36 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
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
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 |
---|---|---|
@@ -0,0 +1,82 @@ | ||
'use client' | ||
|
||
import Link from 'next/link' | ||
import { Button } from './Button' | ||
import { useEffect, useState } from 'react' | ||
import clsx from 'clsx' | ||
|
||
type Status = { | ||
indicator: 'none' | 'minor' | 'major' | 'critical' | 'error' | ||
description: string | ||
} | ||
|
||
const STATUS_PAGE_BASE_URL = 'https://phase.statuspage.io' | ||
|
||
export const StatusIndicator = () => { | ||
|
||
const [status, setStatus] = useState<Status | null>(null) | ||
const [isLoading, setLoading] = useState<boolean>(false) | ||
|
||
useEffect(() => { | ||
const getStatus = async () => { | ||
|
||
setLoading(true) | ||
try { | ||
await fetch(`${STATUS_PAGE_BASE_URL}/api/v2/status.json`).then(res => { | ||
setLoading(false) | ||
if (!res.ok) throw ('Fetch error') | ||
else { | ||
res.json().then(json => { | ||
setStatus(json.status) | ||
}) | ||
} | ||
}) | ||
} catch (e) { | ||
console.log(`Error getting system status: ${e}`) | ||
setLoading(false) | ||
setStatus({ | ||
indicator: 'error', | ||
description: 'Error fetching status' | ||
}) | ||
} | ||
} | ||
|
||
getStatus() | ||
}, []) | ||
|
||
const statusColor = () => { | ||
let color = 'bg-neutral-500' | ||
switch (status?.indicator) { | ||
case 'none': | ||
color = 'bg-emerald-500' | ||
break | ||
case 'minor': | ||
color = 'bg-yellow-500' | ||
break | ||
case 'major': | ||
color = 'bg-orange-500' | ||
break | ||
case 'critical': | ||
color = 'bg-red-500' | ||
break | ||
default: | ||
color = 'bg-neutral-500' | ||
} | ||
return color | ||
} | ||
|
||
return ( | ||
<Link href={STATUS_PAGE_BASE_URL} target="_blank"> | ||
<Button variant="secondary"> | ||
<span | ||
className={clsx( | ||
'h-2 w-2 mr-1 rounded-full', | ||
statusColor(), | ||
isLoading && 'animate-pulse' | ||
)} | ||
></span> | ||
{status?.description || 'Loading'} | ||
</Button> | ||
</Link> | ||
) | ||
} |
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,7 +1,19 @@ | ||
#!/bin/sh | ||
#!/bin/bash | ||
|
||
# Ensure NEXT_PUBLIC_BACKEND_API_BASE and NEXT_PUBLIC_NEXTAUTH_PROVIDERS are set | ||
if [ -z "$NEXT_PUBLIC_BACKEND_API_BASE" ]; then | ||
echo "NEXT_PUBLIC_BACKEND_API_BASE is not set. Please set it and rerun the script." | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$NEXT_PUBLIC_NEXTAUTH_PROVIDERS" ]; then | ||
echo "NEXT_PUBLIC_NEXTAUTH_PROVIDERS is not set. Please set it and rerun the script." | ||
exit 1 | ||
fi | ||
|
||
find /app/public /app/.next -type f -name "*.js" | | ||
while read file; do | ||
sed -i "s|BAKED_NEXT_PUBLIC_BACKEND_API_BASE|$NEXT_PUBLIC_BACKEND_API_BASE|g" "$file" | ||
sed -i "s|BAKED_NEXT_PUBLIC_NEXTAUTH_PROVIDERS|$NEXT_PUBLIC_NEXTAUTH_PROVIDERS|g" "$file" | ||
sed -i "s|BAKED_NEXT_PUBLIC_APP_HOST|$APP_HOST|g" "$file" | ||
done |
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,7 +1,5 @@ | ||
#!/bin/sh | ||
|
||
# Set up runtime env vars | ||
scripts/replace-variable.sh | ||
|
||
# Start your Next.js app | ||
# Set up runtime env vars and start next server | ||
sh scripts/replace-variable.sh && | ||
yarn start |
Oops, something went wrong.