Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion apps/connect/src/Boot.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Connect, StoreConnect } from '@graphprotocol/hypergraph';
import { PrivyProvider } from '@privy-io/react-auth';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { RouterProvider, createRouter } from '@tanstack/react-router';
import { createRouter, RouterProvider } from '@tanstack/react-router';
import { useLayoutEffect, useRef } from 'react';
import { getAddress } from 'viem';
import { routeTree } from './routeTree.gen';
Expand Down
4 changes: 2 additions & 2 deletions apps/connect/src/components/CreateSpaceCard.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Loading } from '@/components/ui/Loading';
import { cn } from '@/lib/utils';
import { Graph } from '@graphprotocol/grc-20';
import { Key, type Messages, SpaceEvents, SpaceInfo, StoreConnect, Utils } from '@graphprotocol/hypergraph';
import { useIdentityToken } from '@privy-io/react-auth';
import { useQueryClient } from '@tanstack/react-query';
import { useSelector } from '@xstate/store/react';
import { Effect } from 'effect';
import { useState } from 'react';
import { Loading } from '@/components/ui/Loading';
import { cn } from '@/lib/utils';

interface CreateSpaceCardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {}

Expand Down
2 changes: 1 addition & 1 deletion apps/connect/src/components/LogoutButton.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Loading } from '@/components/ui/Loading';
import { Connect } from '@graphprotocol/hypergraph';
import { usePrivy } from '@privy-io/react-auth';
import { useRouter } from '@tanstack/react-router';
import { useState } from 'react';
import { Loading } from '@/components/ui/Loading';

export function LogoutButton() {
const { logout: privyLogout, ready, authenticated } = usePrivy();
Expand Down
2 changes: 1 addition & 1 deletion apps/connect/src/components/SpacesCard.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Popover } from '@base-ui-components/react/popover';
import { Loading } from '@/components/ui/Loading';
import type { PrivateSpaceData } from '@/hooks/use-private-spaces';
import type { PublicSpaceData } from '@/hooks/use-public-spaces';
import { cn } from '@/lib/utils';
import { Popover } from '@base-ui-components/react/popover';

interface SpacesCardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
spaces: (PublicSpaceData | PrivateSpaceData)[];
Expand Down
2 changes: 1 addition & 1 deletion apps/connect/src/components/ui/Loading.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';

import { cn } from '@/lib/utils';
import { Loader2 } from 'lucide-react';
import { cn } from '@/lib/utils';

interface LoadingProps extends React.HTMLAttributes<HTMLDivElement> {
/** @default false */
Expand Down
2 changes: 1 addition & 1 deletion apps/connect/src/hooks/use-private-spaces.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getAppInfoByIds } from '@/lib/get-app-info-by-ids';
import { Connect } from '@graphprotocol/hypergraph';
import { useIdentityToken } from '@privy-io/react-auth';
import { type UseQueryResult, useQuery } from '@tanstack/react-query';
import { getAppInfoByIds } from '@/lib/get-app-info-by-ids';

export type PrivateSpaceData = {
id: string;
Expand Down
8 changes: 4 additions & 4 deletions apps/connect/src/routes/__root.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import GeoLogo from '@/assets/images/geo-logo-branded.svg?react';
import { LogoutButton } from '@/components/LogoutButton';
import { AppTitle } from '@/components/ui/AppTitle';
import { StoreConnect } from '@graphprotocol/hypergraph';
import { usePrivy } from '@privy-io/react-auth';
import { Outlet, createRootRoute, useLayoutEffect, useRouter } from '@tanstack/react-router';
import { createRootRoute, Outlet, useLayoutEffect, useRouter } from '@tanstack/react-router';
import { TanStackRouterDevtools } from '@tanstack/react-router-devtools';
import { useSelector } from '@xstate/store/react';
import GeoLogo from '@/assets/images/geo-logo-branded.svg?react';
import { LogoutButton } from '@/components/LogoutButton';
import { AppTitle } from '@/components/ui/AppTitle';

export const Route = createRootRoute({
component: () => {
Expand Down
12 changes: 6 additions & 6 deletions apps/connect/src/routes/authenticate.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
import { CreateSpaceCard } from '@/components/CreateSpaceCard';
import { SpacesCard } from '@/components/SpacesCard';
import { Loading } from '@/components/ui/Loading';
import { usePrivateSpaces } from '@/hooks/use-private-spaces';
import { usePublicSpaces } from '@/hooks/use-public-spaces';
import { Graph } from '@graphprotocol/grc-20';
import { Connect, Identity, Key, type Messages, StoreConnect, Utils } from '@graphprotocol/hypergraph';
import { useIdentityToken, usePrivy, useWallets } from '@privy-io/react-auth';
Expand All @@ -14,6 +9,11 @@ import { TriangleAlert } from 'lucide-react';
import { useEffect, useState } from 'react';
import { createWalletClient, custom } from 'viem';
import { privateKeyToAccount } from 'viem/accounts';
import { CreateSpaceCard } from '@/components/CreateSpaceCard';
import { SpacesCard } from '@/components/SpacesCard';
import { Loading } from '@/components/ui/Loading';
import { usePrivateSpaces } from '@/hooks/use-private-spaces';
import { usePublicSpaces } from '@/hooks/use-public-spaces';

const CHAIN = import.meta.env.VITE_HYPERGRAPH_CHAIN === 'geogenesis' ? Connect.GEOGENESIS : Connect.GEO_TESTNET;
const API_URL =
Expand Down Expand Up @@ -327,7 +327,7 @@ function AuthenticateComponent() {

try {
const privyProvider = await embeddedWallet.getEthereumProvider();
const walletClient = createWalletClient({
const _walletClient = createWalletClient({
account: embeddedWallet.address as `0x${string}`,
chain: CHAIN,
transport: custom(privyProvider),
Expand Down
6 changes: 3 additions & 3 deletions apps/connect/src/routes/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Graph } from '@graphprotocol/grc-20';
import { useIdentityToken } from '@privy-io/react-auth';
import { createFileRoute } from '@tanstack/react-router';
import { CreateSpaceCard } from '@/components/CreateSpaceCard';
import { SpacesCard } from '@/components/SpacesCard';
import { Loading } from '@/components/ui/Loading';
import { usePrivateSpaces } from '@/hooks/use-private-spaces';
import { usePublicSpaces } from '@/hooks/use-public-spaces';
import { Graph } from '@graphprotocol/grc-20';
import { useIdentityToken } from '@privy-io/react-auth';
import { createFileRoute } from '@tanstack/react-router';

export const Route = createFileRoute('/')({
component: Index,
Expand Down
6 changes: 3 additions & 3 deletions apps/connect/src/routes/login.lazy.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import GeoLogo from '@/assets/images/geo-logo-branded.svg?react';
import { AppTitle } from '@/components/ui/AppTitle';
import { Connect, type Identity } from '@graphprotocol/hypergraph';
import { type ConnectedWallet, useIdentityToken, usePrivy, useWallets } from '@privy-io/react-auth';
import { createLazyFileRoute, useRouter } from '@tanstack/react-router';
import { useCallback, useEffect, useState } from 'react';
import { type WalletClient, createWalletClient, custom } from 'viem';
import { createWalletClient, custom, type WalletClient } from 'viem';
import GeoLogo from '@/assets/images/geo-logo-branded.svg?react';
import { AppTitle } from '@/components/ui/AppTitle';

const CHAIN = import.meta.env.VITE_HYPERGRAPH_CHAIN === 'geogenesis' ? Connect.GEOGENESIS : Connect.GEO_TESTNET;
const syncServerUri = import.meta.env.VITE_HYPERGRAPH_SYNC_SERVER_ORIGIN;
Expand Down
13 changes: 11 additions & 2 deletions apps/create-hypergraph-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
"create-hypergraph-app": "dist/bin.js",
"cha": "dist/bin.js"
},
"files": ["dist", "template-*"],
"files": [
"dist",
"template-*"
],
"repository": {
"type": "git",
"url": "git+https://github.com/graphprotocol/hypergraph.git",
Expand All @@ -18,7 +21,13 @@
"directory": "dist",
"linkDirectory": false
},
"keywords": ["The Graph", "Web3", "Knowledge Graph", "Hypergraph", "TypeSyncs"],
"keywords": [
"The Graph",
"Web3",
"Knowledge Graph",
"Hypergraph",
"TypeSyncs"
],
"license": "MIT",
"engines": {
"node": ">=20"
Expand Down
2 changes: 1 addition & 1 deletion apps/events/src/Boot.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { HypergraphAppProvider } from '@graphprotocol/hypergraph-react';
import { RouterProvider, createRouter } from '@tanstack/react-router';
import { createRouter, RouterProvider } from '@tanstack/react-router';
import { mapping } from './mapping.js';
import { routeTree } from './routeTree.gen';

Expand Down
5 changes: 4 additions & 1 deletion apps/events/src/components/create-events.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import { Button } from './ui/button';
const createEvents = async ({
smartSessionClient,
space,
}: { smartSessionClient: Connect.SmartSessionClient; space: string }) => {
}: {
smartSessionClient: Connect.SmartSessionClient;
space: string;
}) => {
try {
const ops: Array<Op> = [];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import { Card, CardContent } from './ui/card';
const createPropertiesAndTypesEvent = async ({
smartSessionClient,
space,
}: { smartSessionClient: Connect.SmartSessionClient; space: string }) => {
}: {
smartSessionClient: Connect.SmartSessionClient;
space: string;
}) => {
const ops: Array<Op> = [];
const { id: salaryPropertyId, ops: createSalaryPropertyOps } = Graph.createProperty({
dataType: 'NUMBER',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import { Card, CardContent } from './ui/card';
const createPropertiesAndTypesTodos = async ({
smartSessionClient,
space,
}: { smartSessionClient: Connect.SmartSessionClient; space: string }) => {
}: {
smartSessionClient: Connect.SmartSessionClient;
space: string;
}) => {
const ops: Array<Op> = [];
const { id: checkedPropertyId, ops: createCheckedPropertyOps } = Graph.createProperty({
dataType: 'CHECKBOX',
Expand Down
2 changes: 1 addition & 1 deletion apps/events/src/components/spinner.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';

import { cn } from '@/lib/utils';
import { motion } from 'framer-motion';
import { cn } from '@/lib/utils';

interface SpinnerProps {
size?: 'sm' | 'md' | 'lg' | 'xl';
Expand Down
2 changes: 1 addition & 1 deletion apps/events/src/components/todos2.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { cn } from '@/lib/utils';
import type { PublishDiffInfo } from '@graphprotocol/hypergraph-react';
import {
PublishDiff,
Expand All @@ -13,6 +12,7 @@ import {
import { useQueryClient } from '@tanstack/react-query';
import { useEffect, useState } from 'react';
import Select from 'react-select';
import { cn } from '@/lib/utils';
import { Todo2, User } from '../schema';
import { Spinner } from './spinner';
import { TodosLocal } from './todo/todos-local';
Expand Down
2 changes: 1 addition & 1 deletion apps/events/src/components/ui/button.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Slot } from '@radix-ui/react-slot';
import { type VariantProps, cva } from 'class-variance-authority';
import { cva, type VariantProps } from 'class-variance-authority';
import * as React from 'react';

import { cn } from '@/lib/utils';
Expand Down
1 change: 1 addition & 0 deletions apps/events/src/components/ui/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export function Modal({ isOpen, onOpenChange, children }: ModalProps) {

return (
<div className="fixed inset-0 z-50">
{/* biome-ignore lint/a11y/noStaticElementInteractions: Modal has keyboard support via Escape key */}
{/* biome-ignore lint/a11y/useKeyWithClickEvents: Modal has keyboard support via Escape key */}
<div className="fixed inset-0 bg-black/50" onClick={() => onOpenChange(false)} />
<div className="fixed left-[50%] top-[50%] z-50 translate-x-[-50%] translate-y-[-50%] max-h-[90vh] w-[90vw] max-w-2xl">
Expand Down
74 changes: 36 additions & 38 deletions apps/events/src/routes/__root.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Logout } from '@/components/logout';
import { useHypergraphAuth } from '@graphprotocol/hypergraph-react';
import { Link, Outlet, createRootRoute, useLayoutEffect, useRouter } from '@tanstack/react-router';
import { createRootRoute, Link, Outlet, useLayoutEffect, useRouter } from '@tanstack/react-router';
import { TanStackRouterDevtools } from '@tanstack/react-router-devtools';
import { Logout } from '@/components/logout';

export const Route = createRootRoute({
component: () => {
Expand All @@ -25,45 +25,43 @@ export const Route = createRootRoute({
}, [authenticated]);

return (
<>
<div className="flex flex-col min-h-screen">
<header className="px-4 lg:px-6 h-14 flex items-center">
<Link to={authenticated ? '/' : '/login'} className="flex items-center justify-center">
Home
</Link>
<nav className="ml-auto flex gap-4 sm:gap-6">
{authenticated ? (
<div className="flex items-center gap-4">
<Link className="text-xs" to="/playground">
Playground
</Link>
<span className="text-xs text-gray-500 dark:text-gray-400">{identity?.address}</span>
<Logout />
</div>
) : null}
</nav>
</header>
<hr />
<div className="flex flex-col min-h-screen">
<header className="px-4 lg:px-6 h-14 flex items-center">
<Link to={authenticated ? '/' : '/login'} className="flex items-center justify-center">
Home
</Link>
<nav className="ml-auto flex gap-4 sm:gap-6">
{authenticated ? (
<div className="flex items-center gap-4">
<Link className="text-xs" to="/playground">
Playground
</Link>
<span className="text-xs text-gray-500 dark:text-gray-400">{identity?.address}</span>
<Logout />
</div>
) : null}
</nav>
</header>
<hr />

<Outlet />
<Outlet />

<TanStackRouterDevtools />
<TanStackRouterDevtools />

<footer className="flex flex-col gap-2 sm:flex-row py-6 w-full shrink-0 items-center px-4 md:px-6 border-t">
<p className="text-xs text-gray-500 dark:text-gray-400">© 2023 Acme Events. All rights reserved.</p>
<nav className="sm:ml-auto flex gap-4 sm:gap-6">
{/* biome-ignore lint/a11y/useValidAnchor: todo */}
<a className="text-xs hover:underline underline-offset-4" href="#">
Terms of Service
</a>
{/* biome-ignore lint/a11y/useValidAnchor: todo */}
<a className="text-xs hover:underline underline-offset-4" href="#">
Privacy
</a>
</nav>
</footer>
</div>
</>
<footer className="flex flex-col gap-2 sm:flex-row py-6 w-full shrink-0 items-center px-4 md:px-6 border-t">
<p className="text-xs text-gray-500 dark:text-gray-400">© 2023 Acme Events. All rights reserved.</p>
<nav className="sm:ml-auto flex gap-4 sm:gap-6">
{/* biome-ignore lint/a11y/useValidAnchor: todo */}
<a className="text-xs hover:underline underline-offset-4" href="#">
Terms of Service
</a>
{/* biome-ignore lint/a11y/useValidAnchor: todo */}
<a className="text-xs hover:underline underline-offset-4" href="#">
Privacy
</a>
</nav>
</footer>
</div>
);
},
});
3 changes: 1 addition & 2 deletions apps/events/src/routes/account-inbox/$inboxId.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ export const Route = createFileRoute('/account-inbox/$inboxId')({
function RouteComponent() {
const { inboxId } = Route.useParams();
const { identity } = useHypergraphAuth();
const { messages, loading, error } = useOwnAccountInbox(inboxId);

// Ensure we have an authenticated user
if (!identity?.accountAddress) {
return <div>Please login to view your inbox</div>;
}

const { messages, loading, error } = useOwnAccountInbox(inboxId);

if (loading) {
return <div>Loading inbox messages...</div>;
}
Expand Down
8 changes: 4 additions & 4 deletions apps/events/src/routes/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Button } from '@/components/ui/button';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
import { Input } from '@/components/ui/input';
import { store } from '@graphprotocol/hypergraph';
import { useHypergraphApp, useSpaces } from '@graphprotocol/hypergraph-react';
import { Link, createFileRoute } from '@tanstack/react-router';
import { createFileRoute, Link } from '@tanstack/react-router';
import { useSelector } from '@xstate/store/react';
import { useEffect, useState } from 'react';
import { Button } from '@/components/ui/button';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
import { Input } from '@/components/ui/input';

export const Route = createFileRoute('/')({
component: Index,
Expand Down
2 changes: 1 addition & 1 deletion apps/events/src/routes/login.lazy.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Button } from '@/components/ui/button';
import { useHypergraphApp } from '@graphprotocol/hypergraph-react';
import { createLazyFileRoute } from '@tanstack/react-router';
import { Button } from '@/components/ui/button';

export const Route = createLazyFileRoute('/login')({
component: () => <Login />,
Expand Down
4 changes: 2 additions & 2 deletions apps/events/src/routes/playground.lazy.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { HypergraphSpaceProvider } from '@graphprotocol/hypergraph-react';
import { createLazyFileRoute } from '@tanstack/react-router';
import { CreateEvents } from '@/components/create-events';
import { CreatePropertiesAndTypesEvent } from '@/components/create-properties-and-types-event';
import { Playground } from '@/components/playground';
import { HypergraphSpaceProvider } from '@graphprotocol/hypergraph-react';
import { createLazyFileRoute } from '@tanstack/react-router';

export const Route = createLazyFileRoute('/playground')({
component: RouteComponent,
Expand Down
2 changes: 1 addition & 1 deletion apps/events/src/routes/space/$spaceId.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Link, Outlet, createFileRoute } from '@tanstack/react-router';
import { createFileRoute, Link, Outlet } from '@tanstack/react-router';

export const Route = createFileRoute('/space/$spaceId')({
component: RouteComponent,
Expand Down
2 changes: 1 addition & 1 deletion apps/events/src/routes/space/$spaceId/chat.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SpaceChat } from '@/components/SpaceChat';
import { useHypergraphApp } from '@graphprotocol/hypergraph-react';
import { createFileRoute } from '@tanstack/react-router';
import { SpaceChat } from '@/components/SpaceChat';

export const Route = createFileRoute('/space/$spaceId/chat')({
component: RouteComponent,
Expand Down
Loading
Loading