Extract layout

This commit is contained in:
Nikita Karamov 2023-03-27 19:17:35 +02:00
parent 86943968d4
commit 343fcd7bc9
No known key found for this signature in database
GPG key ID: 41D6F71EE78E77CD
2 changed files with 130 additions and 119 deletions

56
src/layouts/layout.astro Normal file
View file

@ -0,0 +1,56 @@
---
/*!
* © 2023 Nikita Karamov
* Licensed under AGPL v3 or later
*/
import "../styles/main.scss";
const { title } = Astro.props;
---
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0"
/>
<title>{title}</title>
<meta
name="description"
content="Share₂Fedi is a share page for Mastodon, Pleroma, Misskey, and others. Type in your post text and the instance URL and click Publish!"
/>
<link
rel="canonical"
href={Astro.url}
/>
<link
rel="icon"
href="/favicon.ico"
sizes="any"
/>
<link
rel="icon"
href="/icon.svg"
type="image/svg+xml"
/>
<link
rel="apple-touch-icon"
href="/apple-touch-icon.png"
/>
<link
rel="manifest"
href="/site.webmanifest"
/>
<meta
name="generator"
content="{Astro.generator}"
/>
</head>
<body>
<slot />
</body>
</html>

View file

@ -3,135 +3,90 @@
* © 2023 Nikita Karamov * © 2023 Nikita Karamov
* Licensed under AGPL v3 or later * Licensed under AGPL v3 or later
*/ */
import Layout from "../layouts/layout.astro";
import InstanceSelect from "../components/instance-select.astro"; import InstanceSelect from "../components/instance-select.astro";
import { Content as PrivacyNotice } from "./_privacy.md"; import { Content as PrivacyNotice } from "./_privacy.md";
import { Content as Licence } from "./_licence.md"; import { Content as Licence } from "./_licence.md";
import "../styles/main.scss";
const searchParameters = new URL(Astro.request.url).searchParams; const searchParameters = new URL(Astro.request.url).searchParams;
const prefilledText = searchParameters.get("text"); const prefilledText = searchParameters.get("text");
const prefilledInstance = searchParameters.get("instance"); const prefilledInstance = searchParameters.get("instance");
--- ---
<!DOCTYPE html> <Layout title="Share₂Fedi — an instance-agnostic share page for the Fediverse">
<html lang="en"> <header>
<head> <img
<meta charset="utf-8" /> src="/logo.svg"
<meta alt="Share2Fedi"
name="viewport" width="195"
content="width=device-width, initial-scale=1.0" height="60"
/>
<title>
Share₂Fedi &mdash; an instance-agnostic share page for the Fediverse
</title>
<meta
name="description"
content="Share₂Fedi is a share page for Mastodon, Pleroma, Misskey, and others. Type in your post text and the instance URL and click Publish!"
/>
<link
rel="canonical"
href="https://s2f.kytta.dev/"
/> />
</header>
<main>
<form
id="js-s2f-form"
action="/api/share"
method="POST"
>
<label>
Post text
<textarea
name="text"
id="text"
rows="7"
placeholder="What's on your mind?"
required
>{prefilledText}</textarea
>
</label>
<link <InstanceSelect prefilledInstance={prefilledInstance} />
rel="icon"
href="/favicon.ico"
sizes="any"
/>
<link
rel="icon"
href="/icon.svg"
type="image/svg+xml"
/>
<link
rel="apple-touch-icon"
href="/apple-touch-icon.png"
/>
<link
rel="manifest"
href="/site.webmanifest"
/>
<meta <input
name="generator" type="submit"
content="{Astro.generator}" value="Publish"
/>
</head>
<body>
<header>
<img
src="/logo.svg"
alt="Share2Fedi"
width="195"
height="60"
/> />
</header> </form>
<main> </main>
<form <aside>
id="js-s2f-form" <p>
action="/api/share" Share₂Fedi is an instance-agnostic share page for
method="POST" <a href="https://en.wikipedia.org/wiki/Fediverse">the Fediverse</a>. With
> it, you can post to various federated platforms from a single page.
<label> </p>
Post text <p><b>Supported projects:</b></p>
<textarea <ul>
name="text" <li>Mastodon</li>
id="text" <li>
rows="7" Pleroma (incl. Akkoma) <small><b>(new!)</b></small>
placeholder="What's on your mind?" </li>
required <li>
>{prefilledText}</textarea Misskey <small><b>(new!)</b></small>
> </li>
</label> <li>
Friendica <small><b>(new!)</b></small>
<InstanceSelect prefilledInstance={prefilledInstance} /> </li>
<li>
<input Hubzilla <small><b>(new!)</b></small>
type="submit" </li>
value="Publish" <li>
/> GNU Social <small><b>(new!)</b></small>
</form> </li>
</main> </ul>
<aside> <p>
<p> Share₂Fedi is developed and maintained by
Share₂Fedi is an instance-agnostic share page for <a href="https://www.kytta.dev/">Nikita Karamov</a>. Source code is
<a href="https://en.wikipedia.org/wiki/Fediverse">the Fediverse</a>. <a href="https://github.com/kytta/share2fedi">on GitHub</a>. Hosted with
With it, you can post to various federated platforms from a single page. <a href="https://vercel.com">Vercel</a>.
</p> <a href="https://stats.uptimerobot.com/QOXj3uXPDX">Status page</a>.
<p><b>Supported projects:</b></p> </p>
<ul> <details>
<li>Mastodon</li> <summary>Licence</summary>
<li> <Licence />
Pleroma (incl. Akkoma) <small><b>(new!)</b></small> </details>
</li> <details>
<li> <summary>Privacy Notice</summary>
Misskey <small><b>(new!)</b></small> <PrivacyNotice />
</li> </details>
<li> </aside>
Friendica <small><b>(new!)</b></small> </Layout>
</li>
<li>
Hubzilla <small><b>(new!)</b></small>
</li>
<li>
GNU Social <small><b>(new!)</b></small>
</li>
</ul>
<p>
Share₂Fedi is developed and maintained by
<a href="https://www.kytta.dev/">Nikita Karamov</a>. Source code is
<a href="https://github.com/kytta/share2fedi">on GitHub</a>. Hosted with
<a href="https://vercel.com">Vercel</a>.
<a href="https://stats.uptimerobot.com/QOXj3uXPDX">Status page</a>.
</p>
<details>
<summary>Licence</summary>
<Licence />
</details>
<details>
<summary>Privacy Notice</summary>
<PrivacyNotice />
</details>
</aside>
</body>
</html>