Astro app
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
---
|
||||
import BaseLayout from '@layouts/Base.astro';
|
||||
import Main from '../../web-check-live/main.tsx';
|
||||
import '../../web-check-live/styles/index.css';
|
||||
|
||||
@@ -14,21 +15,28 @@ if (searchUrl) {
|
||||
|
||||
---
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Results</title>
|
||||
<meta charset="UTF-8">
|
||||
</head>
|
||||
<body>
|
||||
<Main {pathname} client:load />
|
||||
</body>
|
||||
</html>
|
||||
<BaseLayout>
|
||||
<Main {pathname} client:load />
|
||||
</BaseLayout>
|
||||
|
||||
<script>
|
||||
// Fallback, if Astro hasn't initialized the RC comp yet, use JS to redirect
|
||||
// Fallback, if Astro hasn't initialized the RC comp yet, then check the url
|
||||
// And if form has been submitted with ?url=, redirect to the results page
|
||||
const searchParams = new URL(window.location.href).searchParams;
|
||||
if (searchParams.has('url')) {
|
||||
window.location.href = `/check/${searchParams.get('url')}`;
|
||||
}
|
||||
|
||||
// And add a manual no-react form submit handler
|
||||
const form = document.querySelector<HTMLFormElement>('form');
|
||||
if (form) {
|
||||
form.addEventListener('submit', function(event: Event) {
|
||||
event.preventDefault();
|
||||
const input = (this as HTMLFormElement).querySelector<HTMLInputElement>('input[name="url"]');
|
||||
if (input && input.value) {
|
||||
window.location.href = `/check/${encodeURIComponent(input.value)}`;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
import BaseLayout from '@layouts/Base.astro';
|
||||
---
|
||||
|
||||
<BaseLayout title="API Docs | Web Check">
|
||||
<BaseLayout
|
||||
title="API Docs | Web Check"
|
||||
description="API documentation for the Web Check backend REST endpoints"
|
||||
>
|
||||
<Fragment slot="head">
|
||||
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/4.1.3/swagger-ui.css">
|
||||
<link rel="stylesheet" href="https://rawcdn.githack.com/Amoenus/SwaggerDark/2064ccd45b571865a64c731fa6bfddfbf2a01fe1/SwaggerDark.css">
|
||||
@@ -23,20 +26,21 @@ import BaseLayout from '@layouts/Base.astro';
|
||||
SwaggerUIBundle.presets.apis,
|
||||
SwaggerUIBundle.SwaggerUIStandalonePreset
|
||||
],
|
||||
plugins: [
|
||||
SwaggerUIBundle.plugins.DownloadUrl
|
||||
]
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import '@styles/global.scss';
|
||||
main {
|
||||
padding: 0 2rem;
|
||||
margin: 0 auto;
|
||||
height: 100vh;
|
||||
width: 100vw;
|
||||
max-width: 1600px;
|
||||
@include mobile-down {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user