Skip to content

Commit a669675

Browse files
committed
Minor: add more context on and around the collaborative clicker example.
1 parent 93f8daa commit a669675

File tree

5 files changed

+46
-17
lines changed

5 files changed

+46
-17
lines changed

examples/README.md

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,50 @@
11
# TrailBase Examples
22

3-
#### Blog
3+
#### [Blog](blog/)
44

55
A simple styled Blog example with UIs both for web and Flutter:
66

77
<p align="center">
88
<picture align="center">
99
<img
1010
height="420"
11-
src="https://raw.githubusercontent.com/ignatz/trailbase/refs/heads/main/examples/blog/assets/screenshot_web.png"
12-
alt="Screenshot Web"
11+
src="https://raw.githubusercontent.com/ignatz/trailbase/refs/heads/main/examples/blog/screenshots/screenshot_web.png"
12+
alt="Blog Web"
1313
/>
1414
</picture>
1515

1616
<picture align="center">
1717
<img
1818
height="420"
19-
src="https://raw.githubusercontent.com/ignatz/trailbase/refs/heads/main/examples/blog/assets/screenshot_flutter.png"
20-
alt="Screenshot Flutter"
19+
src="https://raw.githubusercontent.com/ignatz/trailbase/refs/heads/main/examples/blog/screenshots/screenshot_flutter.png"
20+
alt="BlogFlutter"
2121
/>
2222
</picture>
2323
</p>
2424

25-
#### Coffee Search
25+
#### [Collaborate Server-Side Rendered Clicker](collab-clicker-ssr/)
2626

27-
A very small web app demonstrating vector search and custom JS/TS endpoints.
27+
A small clicker application, where we can collaboratively make it go 🚀. It
28+
show-cases server-side rendering using SolidJS, however it could equally be
29+
React, Vue, Svelte, Preact, ... . After client-side hydration, click counter
30+
changes are streamed to everyone listening.
2831

29-
#### First App Tutorial
32+
<p align="center">
33+
<picture align="center" height="420">
34+
![Collaborative acorn clicker](collab-clicker-ssr/screenshots/screenshot0.png)
35+
</picture>
36+
</p>
37+
38+
#### [Coffee Search](coffee-vector-search/)
39+
40+
A small single-page web app demonstrating vector search and custom JS/TS endpoints.
41+
42+
#### [Data CLI App](data-cli-tutorial/)
3043

31-
The code for the [tutorial](https://trailbase.io/getting-started/first-app).
44+
This code belongs to the command-line app
45+
[tutorial](https://trailbase.io/getting-started/first-cli-app): IMDB data is
46+
ingested and queried both with curl using the record list API and a custom CLI.
3247

33-
#### Custom Rust Binary
48+
#### [Custom Rust Binary](custom-binary/)
3449

3550
A quick example on how to use TrailBase as a library.
File renamed without changes.
File renamed without changes.
59.6 KB
Loading

examples/collab-clicker-ssr/src/App.tsx

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { createSignal, onMount } from "solid-js"
2+
import logo from "../public/favicon.svg";
23

34
export type Clicked = {
45
count: number
@@ -58,20 +59,33 @@ export function App({ initialCount }: { initialCount?: number }) {
5859

5960
return (
6061
<div class="flex flex-col gap-4 text-neutral-800">
61-
<h1>TrailBase Clicker</h1>
62+
<h1>TrailBase</h1>
6263

63-
<div class="px-4 py-2">
64+
<div>
6465
<button
65-
class="rounded bg-neutral-100 p-2 font-medium hover:scale-110 hover:outline outline-accent-600 active:scale-100 animate-all"
66+
class="p-2 rounded-full hover:bg-accent-200 hover:scale-100 active:scale-90 animate-all"
6667
onClick={onClick}
6768
>
68-
clicked {count()} times
69+
<img class="size-[256px] m-2" src={logo} />
6970
</button>
7071
</div>
7172

72-
<p>
73-
Click the button across different tabs, windows or browsers.
74-
</p>
73+
<button class="px-4 py-2" onClick={onClick}>
74+
<span class="p-2 bg-neutral-100 rounded font-bold">Clicked {count()} times</span>
75+
</button>
76+
77+
<p>Click the acorn across different tabs, browsers or computers.</p>
78+
79+
<div class="m-4 p-4 outline outline-1 outline-natural-200 rounded text-sm max-w-[680px]">
80+
<p class="font-bold py-1">Context</p>
81+
<p>
82+
This page showcases TrailBase's "realtime" APIs and server-side rendering (SSR) capabilities.
83+
The initial page-load contains pre-rendered HTML, which is then hydrated on the client.
84+
This reduces latency by saving the client a round-trip to fetch the initial counter value.
85+
The client also subscribes to counter changes and is updates the page whenever someone else
86+
presses the acorn.
87+
</p>
88+
</div>
7589
</div>
7690
)
7791
}

0 commit comments

Comments
 (0)