Skip to content

Mikec/visual examples #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 81 commits into from
Aug 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
7893a4a
wip
mikecann Aug 1, 2025
57497be
wip adding a vite project
mikecann Aug 1, 2025
268cb77
fixed quotes issues
mikecann Aug 1, 2025
9a20ce8
fixed typechecking failing on tests by excluding
mikecann Aug 1, 2025
24d23dc
using mantine instead of tailwind
mikecann Aug 1, 2025
5cf57fa
wip
mikecann Aug 1, 2025
8f2c328
wip example ui
mikecann Aug 1, 2025
3b01e65
fixing error in this example
mikecann Aug 1, 2025
3b7eae2
wip design
mikecann Aug 1, 2025
989107f
added some nicer styling
mikecann Aug 1, 2025
efc2d90
wip
mikecann Aug 1, 2025
7295039
tidy
mikecann Aug 1, 2025
8b9282b
responsive stats page
mikecann Aug 1, 2025
8a9d6e9
fixed sidebar
mikecann Aug 1, 2025
f99bb01
better styles
mikecann Aug 1, 2025
17e8c62
wip
mikecann Aug 1, 2025
46c243a
wip resetting
mikecann Aug 1, 2025
451cbce
clearing issue?
mikecann Aug 1, 2025
b6359f5
tests pass but ts failing
mikecann Aug 1, 2025
6ec7a5c
removing any
mikecann Aug 1, 2025
d27f76a
fixed tests
mikecann Aug 1, 2025
639b40e
added a couple of basic tests
mikecann Aug 3, 2025
acc1fc2
replicated the clearAll issue
mikecann Aug 4, 2025
f763dc5
fixed clear issue
mikecann Aug 4, 2025
d836909
tidy tests a bit more
mikecann Aug 4, 2025
b8405ed
Merge branch 'mikec/fixing-clearAll' into mikec/visual-examples
mikecann Aug 4, 2025
e7cee5f
tidied up vron
mikecann Aug 4, 2025
1e053a5
improved photos examepl
mikecann Aug 4, 2025
05e2867
improved shuffle example
mikecann Aug 4, 2025
aa27981
wip baseline tests
mikecann Aug 4, 2025
b29cc03
bounds now optional
mikecann Aug 4, 2025
5ed5e5f
wip optional bounds
mikecann Aug 4, 2025
e0b2100
tidied tests up a bunch
mikecann Aug 4, 2025
60c01bc
didnt need to be partial
mikecann Aug 4, 2025
2a1cfc3
Merge branch 'mikec/optional-bounds-for-count' into mikec/visual-exam…
mikecann Aug 4, 2025
d39403b
tests fixed ts not
mikecann Aug 4, 2025
581275a
tidy
mikecann Aug 4, 2025
5eed5ff
tidying up the visual examples some more
mikecann Aug 4, 2025
c2b9c71
now adding a structured dump too
mikecann Aug 4, 2025
0deeb58
wip
mikecann Aug 4, 2025
1aeeaa5
using simpler tree
mikecann Aug 4, 2025
f332123
tweaked how its shown
mikecann Aug 4, 2025
6ac90d2
back to basics on btree demo
mikecann Aug 4, 2025
0d18a98
Merge branch 'main' into mikec/visual-examples
mikecann Aug 5, 2025
06fc789
wip getting the trees and nodes
mikecann Aug 5, 2025
1706928
wip app shelll
mikecann Aug 5, 2025
244e889
tidy up
mikecann Aug 5, 2025
122821f
tidied up a bit
mikecann Aug 5, 2025
e2d49b4
proper sizing
mikecann Aug 5, 2025
6c9c315
more wip on the btree view
mikecann Aug 5, 2025
0979ce2
parallel
mikecann Aug 6, 2025
a7f1675
cron reset of btree
mikecann Aug 6, 2025
6b0eccf
fixed runtime issue
mikecann Aug 6, 2025
ab7ca68
makeing adding a photo random
mikecann Aug 6, 2025
c45f2e7
bumped readme
mikecann Aug 6, 2025
7a48628
fixed uneaven header
mikecann Aug 6, 2025
c60d9f3
split sections up a bit
mikecann Aug 6, 2025
787fe66
paginated leaderbaord
mikecann Aug 6, 2025
bed4d38
better leaderboard layout
mikecann Aug 6, 2025
455e13d
small refactors
mikecann Aug 6, 2025
1f032a7
suffle page aside
mikecann Aug 6, 2025
66ddd9f
better splitting up of the components with asides
mikecann Aug 6, 2025
9339ee1
bounds optional
mikecann Aug 6, 2025
7d6f1f9
tidy up the page lookup
mikecann Aug 6, 2025
fc5547d
tidied up a couple of things
mikecann Aug 7, 2025
4737ea5
also allowing editing on the leaderboard rows
mikecann Aug 7, 2025
32059b3
polishing with a convex logo
mikecann Aug 7, 2025
30b0c51
removing the index and using triggers
mikecann Aug 11, 2025
6c29eab
added some more comments
mikecann Aug 11, 2025
d0b495a
better variable names
mikecann Aug 11, 2025
ccd3b8d
fixed example tests
mikecann Aug 12, 2025
ccddc39
Merge branch 'main' into mikec/visual-examples
mikecann Aug 12, 2025
31b4816
fixed npm install
mikecann Aug 12, 2025
28f5483
added thumb to readme
mikecann Aug 12, 2025
7487b55
removed package lock as suggested
mikecann Aug 13, 2025
d333e81
fixing setup script in the example
mikecann Aug 13, 2025
1f99230
using the table validator instead
mikecann Aug 13, 2025
f122d9b
preventing the resetAndSeed from potentially timing out
mikecann Aug 13, 2025
73f1d4b
lowered ui function
mikecann Aug 13, 2025
5946457
simplified imports
mikecann Aug 13, 2025
b2f77cc
nicer flowing of code
mikecann Aug 13, 2025
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
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
This Convex component calculates count and sums of values for efficient
aggregation.

[![Efficient COUNT, SUM, MAX with the Aggregate Component](https://thumbs.video-to-markdown.com/9c06ce06.jpg)](https://youtu.be/YD3nW_PtHWA)

Suppose you have a leaderboard of game scores. These are some operations
that the Aggregate component makes easy and efficient:

Expand Down Expand Up @@ -307,9 +309,7 @@ const randomize = new TableAggregate<{
Key: null;
DataModel: DataModel;
TableName: "mytable";
}>(components.aggregate, {
sortKey: (doc) => null,
});
}>(components.aggregate, { sortKey: (doc) => null });
```

Without sorting, all documents are ordered by their `_id` which is generally
Expand All @@ -331,10 +331,10 @@ For this example, imagine you have a table of photo albums.
```ts
// convex/schema.ts
defineSchema({
photos: defineTable({
album: v.string(),
url: v.string(),
}).index("by_album_creation_time", ["album"]),
photos: defineTable({ album: v.string(), url: v.string() }).index(
"by_album_creation_time",
["album"]
),
});
```

Expand Down Expand Up @@ -390,10 +390,9 @@ import { DataModel } from "./_generated/dataModel";
import { DirectAggregate } from "@convex-dev/aggregate";
// Note the `id` should be unique to be a tie-breaker in case two data points
// have the same key.
const aggregate = new DirectAggregate<{
Key: number;
Id: string;
}>(components.aggregate);
const aggregate = new DirectAggregate<{ Key: number; Id: string }>(
components.aggregate
);

// within a mutation, add values to be aggregated
await aggregate.insert(ctx, { key, id });
Expand Down
676 changes: 676 additions & 0 deletions example/.cursor/rules/convex_rules.mdc

Large diffs are not rendered by default.

34 changes: 21 additions & 13 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
!**/glob-import/dir/node_modules
.DS_Store
.idea
*.cpuprofile
*.local
# Logs
logs
*.log
/.vscode/
/docs/.vitepress/cache
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
explorations
node_modules
playground-temp
temp
TODOs.md
.eslintcache
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
13 changes: 10 additions & 3 deletions example/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# Example app
# Example App

See convex/config.ts and convex/leaderboard.ts for example usages of the
Aggregate component.
## To run the examples

Once you have cloned this repo, **from the root of the repo**:

```bash
npm run setup
```

You will need to follow the instructions to setup a Convex project. Once done you should be able to open the example at `http://localhost:5173/`
Loading