@@ -0,0 +1,103 @@
1+import { useState, useEffect } from 'react';
2+import Head from "next/head";
3+import Meta from "../components/Meta";
9+} from "@urbit/foundation-design-system";
10+import Header from "../components/Header";
11+import Footer from "../components/Footer";
13+const postReq = (path, params, method='post') => {
14+ const form = document.createElement('form');
15+ form.method = method;
18+ for (const key in params) {
19+ if (params.hasOwnProperty(key)) {
20+ const hiddenField = document.createElement('input');
21+ hiddenField.type = 'hidden';
22+ hiddenField.name = key;
23+ hiddenField.value = params[key];
25+ form.appendChild(hiddenField);
29+ document.body.appendChild(form);
35+export default function Trial(props) {
40+ const [count, setCount] = useState(0)
43+ fetch('https://api.shore.arvo.network/count', {
45+ headers: {'Content-Type': 'application/json'}
47+ .then(res => res.json())
49+ setCount(data.count);
53+ const available = count > 0;
55+ const buttonBg = available ? '' : 'pink';
60+ <title>Trial • urbit.org</title>
63+ <IntraNav ourSite="https://urbit.org" search={props.search} />
66+ <Section className="pt-8">
68+ <p className="mt-12">There are currently {count} trial comets left.</p>
70+ <div className="layout px-4 md:px-8">
71+ <a className="p-8 button-lg bg-green-400 text-white"
72+ style={{"backgroundColor": buttonBg}}
80+ fetch('https://api.shore.arvo.network/enter', {
82+ headers: {'Content-Type': 'application/json'}
86+ throw 'Error response from shore api.';
91+ postReq(data.url + '/~/login', {password: data.code, redirect: '/'});
93+ .catch(e => setCount(0));
96+ {available ? 'Try now' : 'No trial comets available, try again later'}