Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions src/components/CopyTextButton.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
interface Props {
value: string;
label: string;
successMessage?: string;
fallbackMessage?: string;
tone?: "default" | "dark";
}

const {
value,
label,
successMessage = "Copied.",
fallbackMessage = "Select and copy the text above.",
tone = "default",
} = Astro.props;
---

<div
class:list={["copy-text-control", { "copy-text-control-dark": tone === "dark" }]}
data-copy-control
data-copy-value={value}
data-copy-success={successMessage}
data-copy-fallback={fallbackMessage}
>
<button class="button button-small" type="button" data-copy-trigger>{label}</button>
<p class="copy-text-status" aria-live="polite"></p>
</div>

<script>
document.querySelectorAll<HTMLElement>("[data-copy-control]").forEach((control) => {
if (control.dataset.copyReady === "true") return;
control.dataset.copyReady = "true";

const button = control.querySelector<HTMLButtonElement>("[data-copy-trigger]");
const status = control.querySelector<HTMLElement>(".copy-text-status");

button?.addEventListener("click", async () => {
try {
await navigator.clipboard.writeText(control.dataset.copyValue ?? "");
if (status) status.textContent = control.dataset.copySuccess ?? "Copied.";
} catch {
if (status) status.textContent = control.dataset.copyFallback ?? "Select and copy the text above.";
}
});
});
</script>

<style>
.copy-text-control {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 0.5rem 1rem;
margin-top: 0.85rem;
}

.copy-text-status {
min-height: 1.5em;
margin: 0;
color: var(--ink-soft);
font-size: 0.8rem;
}

.copy-text-control-dark {
padding-inline: 1.5rem;
}

.copy-text-control-dark .copy-text-status {
color: #bbc1d3;
}
</style>
23 changes: 4 additions & 19 deletions src/pages/ai-builders.astro
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
---
import ArrowIcon from "../components/ArrowIcon.astro";
import CtaBand from "../components/CtaBand.astro";
import CopyTextButton from "../components/CopyTextButton.astro";
import BaseLayout from "../layouts/BaseLayout.astro";
import { site } from "../data/site";

const installCommand = `composer create-project ph7software/ph7builder:${site.latestRelease} my-dating-app --no-dev --prefer-dist`;
---

<BaseLayout title="pH7Builder for AI builders" description="Give Codex, Claude Code or another AI coding agent an established open-source dating and community foundation to understand, customise and test." path="/ai-builders/">
Expand All @@ -28,8 +31,7 @@ import { site } from "../data/site";
<pre><code><span>$</span> composer create-project \
ph7software/ph7builder:{site.latestRelease} \
my-dating-app --no-dev --prefer-dist</code></pre>
<button class="copy-command button button-small" type="button" data-copy={`composer create-project ph7software/ph7builder:${site.latestRelease} my-dating-app --no-dev --prefer-dist`}>Copy command</button>
<p class="copy-status" aria-live="polite"></p>
<CopyTextButton value={installCommand} label="Copy command" successMessage="Command copied." tone="dark" />
</div>
</div>
</section>
Expand Down Expand Up @@ -96,20 +98,6 @@ import { site } from "../data/site";
<CtaBand eyebrow="Give your agent a useful brief" title="Start with a product decision, not a pile of files." primaryLabel="Create the blueprint" primaryHref="/build/" secondaryLabel="See Nomad Connections" secondaryHref="/blueprints/nomad-connections/" />
</BaseLayout>

<script>
document.querySelectorAll<HTMLButtonElement>("[data-copy]").forEach((button) => {
button.addEventListener("click", async () => {
const status = button.parentElement?.querySelector<HTMLElement>(".copy-status");
try {
await navigator.clipboard.writeText(button.dataset.copy ?? "");
if (status) status.textContent = "Command copied.";
} catch {
if (status) status.textContent = "Select and copy the command above.";
}
});
});
</script>

<style>
.install-grid,
.readiness-grid {
Expand Down Expand Up @@ -148,9 +136,6 @@ import { site } from "../data/site";
.terminal-bar b { margin-left: auto; color: #9da4ba; font-family: var(--mono); font-size: 0.7rem; }
.terminal pre { padding: 2rem 1.5rem 1rem; margin: 0; overflow-x: auto; font-family: var(--mono); }
.terminal code span { color: var(--lime); }
.terminal button { margin-left: 1.5rem; }
.copy-status { min-height: 1.5rem; margin: 0.75rem 1.5rem 0; color: #bbc1d3; font-size: 0.8rem; }

.agent-context-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
Expand Down
6 changes: 5 additions & 1 deletion src/pages/get-started.astro
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
---
import ArrowIcon from "../components/ArrowIcon.astro";
import CopyTextButton from "../components/CopyTextButton.astro";
import BaseLayout from "../layouts/BaseLayout.astro";
import { site } from "../data/site";

const installCommand = `composer create-project ph7software/ph7builder:${site.latestRelease} my-dating-app --no-dev --prefer-dist`;
---

<BaseLayout title="Get pH7Builder" description="Install the latest published pH7Builder release through Composer or download the source from GitHub." path="/get-started/">
Expand All @@ -15,7 +18,8 @@ import { site } from "../data/site";
<article>
<span class="status-pill">Recommended</span>
<h2>Install through Composer</h2>
<pre><code>composer create-project ph7software/ph7builder:{site.latestRelease} my-dating-app --no-dev --prefer-dist</code></pre>
<pre><code>{installCommand}</code></pre>
<CopyTextButton value={installCommand} label="Copy install command" successMessage="Install command copied." />
<p>This installs the current published release and creates an independent application copy with locked production dependencies. Future application upgrades are explicit rather than automatic Composer library updates.</p>
<a class="button" href="/ai-builders/">Follow the AI builder path<ArrowIcon /></a>
</article>
Expand Down