diff --git a/app/page.tsx b/app/page.tsx new file mode 100644 index 0000000..312b772 --- /dev/null +++ b/app/page.tsx @@ -0,0 +1,32 @@ +import { useEffect, useState } from 'react'; +import { createClient } from '@supabase/supabase-js'; + +const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL || 'https://your-supabase-url'; +const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY || 'your-anon-key'; + +const supabase = createClient(supabaseUrl, supabaseAnonKey); + +export default function Home() { + const [count, setCount] = useState(0); + + useEffect(() => { + const fetchCount = async () => { + const { count: fetchedCount } = await supabase.from('example_table').select('count').single(); + setCount(fetchedCount); + }; + fetchCount(); + }, []); + + return ( +
+

Freight PWA

+

Current count from DB: {count}

+ +
+ ); +} \ No newline at end of file diff --git a/globals.css b/globals.css new file mode 100644 index 0000000..bd6213e --- /dev/null +++ b/globals.css @@ -0,0 +1,3 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; \ No newline at end of file diff --git a/lib/supabase.ts b/lib/supabase.ts new file mode 100644 index 0000000..939032b --- /dev/null +++ b/lib/supabase.ts @@ -0,0 +1,6 @@ +import { createClient } from '@supabase/supabase-js'; + +const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL!; +const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!; + +export const supabase = createClient(supabaseUrl, supabaseAnonKey); \ No newline at end of file diff --git a/package.json b/package.json index 16a1cbd..aabd59f 100644 --- a/package.json +++ b/package.json @@ -1,27 +1,29 @@ { - "name": "internal-freight-app", - "version": "0.1.0", + "name": "freight-pwa", "private": true, + "version": "0.1.0", "scripts": { - "dev": "vite", - "build": "vite build", - "preview": "vite preview" + "dev": "next dev", + "build": "next build", + "start": "next start", + "lint": "next lint", + "type-check": "tsc --noEmit" }, "dependencies": { - "@supabase/supabase-js": "^2.39.0", "@tanstack/react-query": "^5.28.0", - "@tanstack/react-table": "^8.15.0", - "react": "^18.2.0", - "react-dom": "^18.2.0" + "@tanstack/react-query-nextjs": "^5.28.0", + "@supabase/supabase-js": "^2.48.1", + "next": "14.2.3", + "react": "^18.3.1", + "react-dom": "^18.3.1" }, "devDependencies": { - "@types/react": "^18.2.24", - "@types/react-dom": "^18.2.8", - "@vitejs/plugin-react": "^4.2.1", - "autoprefixer": "^10.4.14", - "postcss": "^8.4.21", - "tailwindcss": "^3.3.2", - "vite": "^5.2.0", - "typescript": "^5.4.5" + "@types/node": "^20.12.7", + "@types/react": "^18.3.3", + "@types/react-dom": "^18.3.0", + "autoprefixer": "^10.4.18", + "postcss": "^8.4.35", + "tailwindcss": "^3.4.3", + "typescript": "^5.4.3" } } \ No newline at end of file diff --git a/tailwind.config.js b/tailwind.config.js index 74769d1..f599d47 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,8 +1,11 @@ /** @type {import('tailwindcss').Config} */ module.exports = { - content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"], + content: [ + "./app/**/*.{js,ts,jsx,tsx,mdx}", + "./pages/**/*.{js,ts,jsx,tsx,mdx}", + ], theme: { extend: {}, }, plugins: [], -} \ No newline at end of file +}; \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..3b60b95 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "target": "es6", + "module": "esnext", + "moduleResolution": "node", + "esModuleInterop": true, + "skipLibCheck": true, + "strict": true, + "baseUrl": ".", + "paths": { + "@/*": ["src/*"] + } + }, + "include": ["src/**/*"], + "exclude": ["node_modules"] +} \ No newline at end of file