262 lines
6.0 KiB
HTML
262 lines
6.0 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>rSpace - Collaborative Community Spaces</title>
|
|
<style>
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
|
|
color: white;
|
|
min-height: 100vh;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.container {
|
|
text-align: center;
|
|
max-width: 600px;
|
|
padding: 40px 20px;
|
|
}
|
|
|
|
h1 {
|
|
font-size: 3rem;
|
|
margin-bottom: 1rem;
|
|
background: linear-gradient(135deg, #14b8a6, #22d3ee);
|
|
-webkit-background-clip: text;
|
|
-webkit-text-fill-color: transparent;
|
|
}
|
|
|
|
.tagline {
|
|
font-size: 1.25rem;
|
|
color: #94a3b8;
|
|
margin-bottom: 3rem;
|
|
}
|
|
|
|
.create-form {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 1rem;
|
|
background: rgba(255, 255, 255, 0.05);
|
|
padding: 2rem;
|
|
border-radius: 16px;
|
|
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
}
|
|
|
|
.form-group {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.5rem;
|
|
text-align: left;
|
|
}
|
|
|
|
label {
|
|
font-size: 0.875rem;
|
|
color: #94a3b8;
|
|
}
|
|
|
|
input {
|
|
padding: 12px 16px;
|
|
border-radius: 8px;
|
|
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
background: rgba(255, 255, 255, 0.05);
|
|
color: white;
|
|
font-size: 1rem;
|
|
}
|
|
|
|
input:focus {
|
|
outline: none;
|
|
border-color: #14b8a6;
|
|
}
|
|
|
|
input::placeholder {
|
|
color: #64748b;
|
|
}
|
|
|
|
.slug-preview {
|
|
font-size: 0.875rem;
|
|
color: #64748b;
|
|
margin-top: 0.25rem;
|
|
}
|
|
|
|
.slug-preview span {
|
|
color: #14b8a6;
|
|
}
|
|
|
|
button {
|
|
padding: 14px 28px;
|
|
border-radius: 8px;
|
|
border: none;
|
|
background: linear-gradient(135deg, #14b8a6, #0d9488);
|
|
color: white;
|
|
font-size: 1rem;
|
|
font-weight: 600;
|
|
cursor: pointer;
|
|
transition: transform 0.2s, box-shadow 0.2s;
|
|
}
|
|
|
|
button:hover {
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 8px 20px rgba(20, 184, 166, 0.3);
|
|
}
|
|
|
|
button:active {
|
|
transform: translateY(0);
|
|
}
|
|
|
|
.features {
|
|
display: grid;
|
|
grid-template-columns: repeat(3, 1fr);
|
|
gap: 1.5rem;
|
|
margin-top: 4rem;
|
|
}
|
|
|
|
.feature {
|
|
text-align: center;
|
|
}
|
|
|
|
.feature-icon {
|
|
font-size: 2rem;
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.feature-title {
|
|
font-weight: 600;
|
|
margin-bottom: 0.25rem;
|
|
}
|
|
|
|
.feature-desc {
|
|
font-size: 0.875rem;
|
|
color: #64748b;
|
|
}
|
|
|
|
.error {
|
|
color: #ef4444;
|
|
font-size: 0.875rem;
|
|
margin-top: 0.5rem;
|
|
}
|
|
|
|
.success {
|
|
color: #22c55e;
|
|
font-size: 0.875rem;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<h1>rSpace</h1>
|
|
<p class="tagline">Collaborative community spaces powered by FolkJS</p>
|
|
|
|
<form class="create-form" id="create-form">
|
|
<div class="form-group">
|
|
<label for="community-name">Community Name</label>
|
|
<input
|
|
type="text"
|
|
id="community-name"
|
|
placeholder="e.g. MycoFi Commons"
|
|
required
|
|
/>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="community-slug">Community Slug</label>
|
|
<input
|
|
type="text"
|
|
id="community-slug"
|
|
placeholder="e.g. mycofi"
|
|
pattern="[a-z0-9-]+"
|
|
required
|
|
/>
|
|
<p class="slug-preview">Your space will be at: <span id="slug-preview">___.rspace.online</span></p>
|
|
</div>
|
|
<button type="submit">Create Community Space</button>
|
|
<p class="error" id="error-message" style="display: none;"></p>
|
|
</form>
|
|
|
|
<div class="features">
|
|
<div class="feature">
|
|
<div class="feature-icon">🎨</div>
|
|
<div class="feature-title">Spatial Canvas</div>
|
|
<div class="feature-desc">Infinite collaborative workspace</div>
|
|
</div>
|
|
<div class="feature">
|
|
<div class="feature-icon">🔄</div>
|
|
<div class="feature-title">Real-time Sync</div>
|
|
<div class="feature-desc">Powered by Automerge CRDT</div>
|
|
</div>
|
|
<div class="feature">
|
|
<div class="feature-icon">🌐</div>
|
|
<div class="feature-title">Your Subdomain</div>
|
|
<div class="feature-desc">community.rspace.online</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
const nameInput = document.getElementById("community-name");
|
|
const slugInput = document.getElementById("community-slug");
|
|
const slugPreview = document.getElementById("slug-preview");
|
|
const form = document.getElementById("create-form");
|
|
const errorMessage = document.getElementById("error-message");
|
|
|
|
// Auto-generate slug from name
|
|
nameInput.addEventListener("input", () => {
|
|
const slug = nameInput.value
|
|
.toLowerCase()
|
|
.replace(/[^a-z0-9]+/g, "-")
|
|
.replace(/^-|-$/g, "");
|
|
slugInput.value = slug;
|
|
slugPreview.textContent = slug ? `${slug}.rspace.online` : "___.rspace.online";
|
|
});
|
|
|
|
slugInput.addEventListener("input", () => {
|
|
const slug = slugInput.value.toLowerCase().replace(/[^a-z0-9-]/g, "");
|
|
slugInput.value = slug;
|
|
slugPreview.textContent = slug ? `${slug}.rspace.online` : "___.rspace.online";
|
|
});
|
|
|
|
form.addEventListener("submit", async (e) => {
|
|
e.preventDefault();
|
|
errorMessage.style.display = "none";
|
|
|
|
const name = nameInput.value.trim();
|
|
const slug = slugInput.value.trim();
|
|
|
|
if (!name || !slug) {
|
|
errorMessage.textContent = "Please fill in all fields";
|
|
errorMessage.style.display = "block";
|
|
return;
|
|
}
|
|
|
|
try {
|
|
const response = await fetch("/api/communities", {
|
|
method: "POST",
|
|
headers: { "Content-Type": "application/json" },
|
|
body: JSON.stringify({ name, slug }),
|
|
});
|
|
|
|
const data = await response.json();
|
|
|
|
if (!response.ok) {
|
|
throw new Error(data.error || "Failed to create community");
|
|
}
|
|
|
|
// Redirect to the new community space
|
|
window.location.href = data.url;
|
|
} catch (err) {
|
|
errorMessage.textContent = err.message;
|
|
errorMessage.style.display = "block";
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|