Skip to content
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

Add Metacom #45

Merged
merged 2 commits into from
Jan 24, 2024
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
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NEXT_PUBLIC_URL_PRODUCT_API=ws://messenger-backend.fly.dev
2 changes: 2 additions & 0 deletions .env.local.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
NEXT_PUBLIC_URL_PRODUCT_API=ws://localhost:8000
# NEXT_PUBLIC_URL_PRODUCT_API=ws://messenger-backend.fly.dev
4 changes: 3 additions & 1 deletion next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {}
const nextConfig = {
reactStrictMode: true,
}

module.exports = nextConfig
201 changes: 201 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"prettier:check": "prettier --check .",
"prettier:write": "prettier --write .",
"typescript:check": "tsc -p tsconfig.json",
"env:local": "cp .env.local.dist .env.local",
"prepare": "husky install",
"cspell": "cspell --show-suggestions --show-context --gitignore ."
},
Expand All @@ -20,9 +21,11 @@
"@radix-ui/react-checkbox": "^1.0.4",
"@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-toast": "^1.1.5",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"lucide-react": "^0.312.0",
"metacom": "^3.1.2",
"next": "14.0.3",
"next-themes": "^0.2.1",
"react": "^18",
Expand Down
1 change: 1 addition & 0 deletions project-words.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Autobuild
autofetch
GOLUB
tailwindcss
tsbuildinfo
Expand Down
18 changes: 9 additions & 9 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import type { Metadata } from 'next'
'use client'

import { text, title } from '@/app/fonts'
import '@/app/globals.css'
import { Toaster } from '@/components/ui/toaster'
import Providers from '@/store/providers'
import { FC, ReactNode } from 'react'

export const metadata: Metadata = {
description: 'Generated by create next app',
title: 'Create Next App',
interface PageProps {
children: ReactNode
}

export default function RootLayout({
children,
}: {
children: React.ReactNode
}) {
const Layout: FC<PageProps> = ({ children } = { children: [] }) => {
return (
<html lang="en" suppressHydrationWarning>
<body className={`${title.variable} ${text.variable}`}>
<Providers>{children}</Providers>
<Toaster />
</body>
</html>
)
}

export default Layout
53 changes: 29 additions & 24 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,34 @@
import IconChange from '@/components/ui/icons/IconChange'
import Image from 'next/image'
'use client'

import { Button } from '@/components/ui/button'
import { useToast } from '@/components/ui/use-toast'
import { useApi, useApiContext } from '@/utils'

const Home = () => {
const api = useApiContext()
const condition = true
firehawk89 marked this conversation as resolved.
Show resolved Hide resolved
const { toast } = useToast()

const { fetch, response: calculated } = useApi(
() => condition && api.example.add({ a: 1, b: 2 }),
{
onSuccess: () =>
toast({
title: '🚀 Two numbers added',
}),
}
)
const { response: data } = useApi(() => condition && api.example.data(), {
autofetch: true,
})

export default function Home() {
return (
<div className="flex items-baseline gap-5">
<div className="flex flex-col items-center">
This is Image:{' '}
<Image
alt="change"
className="fill-blue-500"
height={24}
src="/icons/change.svg"
width={24}
/>
</div>
<div className="flex flex-col items-center">
This is an IconChange component:{' '}
<IconChange
className="text-base-gray-1 hover:text-bright-orange transition-colors"
size="lg"
/>
<p>Hover me!</p>
</div>
<div>GOLUB</div>
<div>🚀</div>
<div className="flex items-center justify-center w-screen h-screen gap-20 text-white">
<div>{data}</div>
<Button onClick={fetch}>Calculate 1 + 2</Button>
{calculated}
</div>
)
}

export default Home
Loading