stevekrouse-dateme_react_client.web.val.run
Readme

Date Me Directory

This is entry-point val for the source code for the Date Me Directory. Contributions welcome!

This app uses Hono as the server framework and for JSX.

The vals are stored in Val Town SQLite.

Contributing

Forking this repo should mostly work, except for the sqlite database. You'll need to create the table & populate it with some data. This script should do it, but I think it has a couple bugs. If you're interested in contributing to this project contact me or comment on this val and I'll get it working for ya!

Todos

  • Make the SQLite database forkable and build a widget/workflow for that, ie fix @stevekrouse/dateme_sqlite
  • Require an email (that isn't shared publicly)
    • Verify the email address with a "magic link"
  • Refactor Location to an array of Lat, Lon
    • Geocode all the existing locations
    • Add a geocoder map input to the form
    • Allow selecting multiple location through the form
  • Profile performance & speed up site, possibly add more caching
  • Let people edit their forms
  • Featured profiles
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { loader as browse_loader } from "https://esm.town/v/stevekrouse/dateme_browse_react";
import { action as submit_action } from "https://esm.town/v/stevekrouse/dateme_form_react";
async function server(req: Request) {
const url = new URL(req.url);
if (url.pathname === "/browse") {
return browse_loader({ request: req });
} else if (url.pathname === "/submit") {
return submit_action({ request: req });
} else {
return new Response("Not found", { status: 404 });
}
}
function client(req: Request) {
return new Response(
`<html>
<head>
<title>Date Me Directory</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body></body>
<script type="module" src="https://esm.town/v/stevekrouse/dateme_router"></script>
</html>`,
{
headers: {
"content-type": "text/html",
},
},
);
}
export default function(req: Request) {
if (
req.headers.get("Content-Type") === "application/json"
|| req.method !== "GET"
) {
return server(req);
} else {
return client(req);
}
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
v23
June 18, 2024