Lachlan's avatar@lachlanjc/eduCourses
Shared Minds

Week 5: Social

“Our imagination is the key to our control of the world,” Yuval Noah Harari said. Though his science may be lacking, his imagination is not. The tools we use influence our imagination for what we can do in the world; they provide a shape for our own feelings of agency to grab onto. If our tools are solo, we feel alone. If our tools encourage us to imagine together, that default influences how often we take that route.

Making

This week, I took last week’s project and made it joinable: under the hood, I moved the static friends data to Liveblocks, then added an authentication flow through GitHub using Clerk, all from React Server Components. After you authenticate, it uses your browser’s geolocation to add you to the globe, and you can send vibes.

const addToFriends = useMutation(
({ storage }, lat: number, lng: number) => {
storage.get("friends").push({
lat,
lng,
github: user?.username!,
name: user?.fullName!,
});
},
[user],
);
navigator.geolocation.getCurrentPosition((position) => {
addToFriends(
position.coords.latitude,
position.coords.longitude,
);
});

Try the demoread the source code