Merge pull request 'added pwa support' (#1) from feature/Capacitor into dev
Reviewed-on: #1
This commit was merged in pull request #1.
This commit is contained in:
commit
cd8a8d746d
17 files changed
+5206
-136
No files matched your search
@@ -0,0 +1,9 @@
|
|||||||
|
import type { CapacitorConfig } from "@capacitor/cli";
|
||||||
|
|
||||||
|
const config: CapacitorConfig = {
|
||||||
|
appId: "bettersplit.shrt.solutions",
|
||||||
|
appName: "bettersplit",
|
||||||
|
webDir: "out",
|
||||||
|
};
|
||||||
|
|
||||||
|
export default config;
|
||||||
+11
-3
@@ -3,8 +3,16 @@
|
|||||||
* for Docker builds.
|
* for Docker builds.
|
||||||
*/
|
*/
|
||||||
import "./src/env.js";
|
import "./src/env.js";
|
||||||
|
import pwa from "next-pwa";
|
||||||
|
import { env } from "./src/env.js";
|
||||||
|
|
||||||
/** @type {import("next").NextConfig} */
|
const withPWA = pwa({
|
||||||
const config = {};
|
dest: "public",
|
||||||
|
disable: env.NODE_ENV === "development",
|
||||||
|
register: true, // register the PWA service worker
|
||||||
|
skipWaiting: true,
|
||||||
|
});
|
||||||
|
|
||||||
export default config;
|
export default withPWA({
|
||||||
|
eslint: { ignoreDuringBuilds: true },
|
||||||
|
});
|
||||||
+79
-73
@@ -1,75 +1,81 @@
|
|||||||
{
|
{
|
||||||
"name": "betterwise",
|
"name": "betterwise",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"check": "biome check .",
|
"export": "next export",
|
||||||
"check:unsafe": "biome check --write --unsafe .",
|
"check": "biome check .",
|
||||||
"check:write": "biome check --write .",
|
"check:unsafe": "biome check --write --unsafe .",
|
||||||
"db:generate": "drizzle-kit generate",
|
"check:write": "biome check --write .",
|
||||||
"db:migrate": "drizzle-kit migrate",
|
"db:generate": "drizzle-kit generate",
|
||||||
"db:push": "drizzle-kit push",
|
"db:migrate": "drizzle-kit migrate",
|
||||||
"db:studio": "drizzle-kit studio",
|
"db:push": "drizzle-kit push",
|
||||||
"dev": "next dev --turbo",
|
"db:studio": "drizzle-kit studio",
|
||||||
"preview": "next build && next start",
|
"dev": "next dev --turbo",
|
||||||
"start": "next start",
|
"preview": "next build && next start",
|
||||||
"typecheck": "tsc --noEmit"
|
"start": "next start",
|
||||||
},
|
"typecheck": "tsc --noEmit",
|
||||||
"dependencies": {
|
"android": "pnpm build && pnpm export && pnpm dlx cap sync android && pnpm dlx cap open android"
|
||||||
"@auth/drizzle-adapter": "^1.7.2",
|
},
|
||||||
"@hookform/resolvers": "^5.0.1",
|
"dependencies": {
|
||||||
"@paralleldrive/cuid2": "^2.2.2",
|
"@auth/drizzle-adapter": "^1.7.2",
|
||||||
"@radix-ui/react-avatar": "^1.1.3",
|
"@capacitor/cli": "^7.2.0",
|
||||||
"@radix-ui/react-dialog": "^1.1.6",
|
"@capacitor/core": "^7.2.0",
|
||||||
"@radix-ui/react-dropdown-menu": "^2.1.6",
|
"@hookform/resolvers": "^5.0.1",
|
||||||
"@radix-ui/react-label": "^2.1.2",
|
"@paralleldrive/cuid2": "^2.2.2",
|
||||||
"@radix-ui/react-popover": "^1.1.6",
|
"@radix-ui/react-avatar": "^1.1.3",
|
||||||
"@radix-ui/react-select": "^2.1.6",
|
"@radix-ui/react-dialog": "^1.1.6",
|
||||||
"@radix-ui/react-separator": "^1.1.2",
|
"@radix-ui/react-dropdown-menu": "^2.1.6",
|
||||||
"@radix-ui/react-slot": "^1.1.2",
|
"@radix-ui/react-label": "^2.1.2",
|
||||||
"@radix-ui/react-tabs": "^1.1.3",
|
"@radix-ui/react-popover": "^1.1.6",
|
||||||
"@t3-oss/env-nextjs": "^0.12.0",
|
"@radix-ui/react-select": "^2.1.6",
|
||||||
"@tanstack/react-query": "^5.69.0",
|
"@radix-ui/react-separator": "^1.1.2",
|
||||||
"@trpc/client": "^11.0.0",
|
"@radix-ui/react-slot": "^1.1.2",
|
||||||
"@trpc/react-query": "^11.0.0",
|
"@radix-ui/react-tabs": "^1.1.3",
|
||||||
"@trpc/server": "^11.0.0",
|
"@t3-oss/env-nextjs": "^0.12.0",
|
||||||
"class-variance-authority": "^0.7.1",
|
"@tanstack/react-query": "^5.69.0",
|
||||||
"clsx": "^2.1.1",
|
"@trpc/client": "^11.0.0",
|
||||||
"cmdk": "^1.1.1",
|
"@trpc/react-query": "^11.0.0",
|
||||||
"drizzle-orm": "^0.41.0",
|
"@trpc/server": "^11.0.0",
|
||||||
"lucide-react": "^0.487.0",
|
"@types/next-pwa": "^5.6.9",
|
||||||
"next": "^15.2.3",
|
"class-variance-authority": "^0.7.1",
|
||||||
"next-auth": "5.0.0-beta.25",
|
"clsx": "^2.1.1",
|
||||||
"next-themes": "^0.4.6",
|
"cmdk": "^1.1.1",
|
||||||
"postgres": "^3.4.4",
|
"drizzle-orm": "^0.41.0",
|
||||||
"react": "^19.0.0",
|
"lucide-react": "^0.487.0",
|
||||||
"react-dom": "^19.0.0",
|
"next": "^15.2.3",
|
||||||
"react-hook-form": "^7.55.0",
|
"next-auth": "5.0.0-beta.25",
|
||||||
"server-only": "^0.0.1",
|
"next-pwa": "^5.6.0",
|
||||||
"sonner": "^2.0.3",
|
"next-themes": "^0.4.6",
|
||||||
"superjson": "^2.2.1",
|
"postgres": "^3.4.4",
|
||||||
"tailwind-merge": "^3.1.0",
|
"react": "^19.0.0",
|
||||||
"tw-animate-css": "^1.2.5",
|
"react-dom": "^19.0.0",
|
||||||
"use-debounce": "^10.0.4",
|
"react-hook-form": "^7.55.0",
|
||||||
"vaul": "^1.1.2",
|
"server-only": "^0.0.1",
|
||||||
"zod": "^3.24.2",
|
"sonner": "^2.0.3",
|
||||||
"zustand": "^5.0.3"
|
"superjson": "^2.2.1",
|
||||||
},
|
"tailwind-merge": "^3.1.0",
|
||||||
"devDependencies": {
|
"tw-animate-css": "^1.2.5",
|
||||||
"@biomejs/biome": "1.9.4",
|
"use-debounce": "^10.0.4",
|
||||||
"@tailwindcss/postcss": "^4.0.15",
|
"vaul": "^1.1.2",
|
||||||
"@types/node": "^20.14.10",
|
"zod": "^3.24.2",
|
||||||
"@types/react": "^19.0.0",
|
"zustand": "^5.0.3"
|
||||||
"@types/react-dom": "^19.0.0",
|
},
|
||||||
"drizzle-kit": "^0.30.5",
|
"devDependencies": {
|
||||||
"postcss": "^8.5.3",
|
"@biomejs/biome": "1.9.4",
|
||||||
"tailwindcss": "^4.0.15",
|
"@tailwindcss/postcss": "^4.0.15",
|
||||||
"typescript": "^5.8.2"
|
"@types/node": "^20.14.10",
|
||||||
},
|
"@types/react": "^19.0.0",
|
||||||
"ct3aMetadata": {
|
"@types/react-dom": "^19.0.0",
|
||||||
"initVersion": "7.39.2"
|
"drizzle-kit": "^0.30.5",
|
||||||
},
|
"postcss": "^8.5.3",
|
||||||
"packageManager": "pnpm@10.3.0"
|
"tailwindcss": "^4.0.15",
|
||||||
|
"typescript": "^5.8.2"
|
||||||
|
},
|
||||||
|
"ct3aMetadata": {
|
||||||
|
"initVersion": "7.39.2"
|
||||||
|
},
|
||||||
|
"packageManager": "pnpm@10.3.0"
|
||||||
}
|
}
|
||||||
Generated
+4936
-10
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1 @@
|
|||||||
|
if(!self.define){let e,s={};const t=(t,a)=>(t=new URL(t+".js",a).href,s[t]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=t,e.onload=s,document.head.appendChild(e)}else e=t,importScripts(t),s()})).then((()=>{let e=s[t];if(!e)throw new Error(`Module ${t} didn’t register its module`);return e})));self.define=(a,n)=>{const i=e||("document"in self?document.currentScript.src:"")||location.href;if(s[i])return;let c={};const r=e=>t(e,i),w={module:{uri:i},exports:c,require:r};s[i]=Promise.all(a.map((e=>w[e]||r(e)))).then((e=>(n(...e),c)))}}define(["./workbox-e9849328"],(function(e){"use strict";importScripts(),self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"/_next/app-build-manifest.json",revision:"9ddae6fb651604de7630293119506ed4"},{url:"/_next/static/D_QH_2w1wpvaQUPstb-Bw/_buildManifest.js",revision:"01b09b3e9dda7539be2313c35bd1b563"},{url:"/_next/static/D_QH_2w1wpvaQUPstb-Bw/_ssgManifest.js",revision:"b6652df95db52feb4daf4eca35380933"},{url:"/_next/static/chunks/1-af1f1e25dae140be.js",revision:"D_QH_2w1wpvaQUPstb-Bw"},{url:"/_next/static/chunks/200-1def31964b2356b0.js",revision:"D_QH_2w1wpvaQUPstb-Bw"},{url:"/_next/static/chunks/23-54b4ab21f3550ebc.js",revision:"D_QH_2w1wpvaQUPstb-Bw"},{url:"/_next/static/chunks/283-d8ce32dab0aedc01.js",revision:"D_QH_2w1wpvaQUPstb-Bw"},{url:"/_next/static/chunks/315-7943c6e46aec5d5e.js",revision:"D_QH_2w1wpvaQUPstb-Bw"},{url:"/_next/static/chunks/323-cfe0cbab1e5ba15a.js",revision:"D_QH_2w1wpvaQUPstb-Bw"},{url:"/_next/static/chunks/369-b616bc8f00fc0b77.js",revision:"D_QH_2w1wpvaQUPstb-Bw"},{url:"/_next/static/chunks/427-8d8c459025f4dcb9.js",revision:"D_QH_2w1wpvaQUPstb-Bw"},{url:"/_next/static/chunks/47edcb22-e33a29a5fce76af4.js",revision:"D_QH_2w1wpvaQUPstb-Bw"},{url:"/_next/static/chunks/748-db3977eb7f9230bd.js",revision:"D_QH_2w1wpvaQUPstb-Bw"},{url:"/_next/static/chunks/75-789b1b8b478cf3fd.js",revision:"D_QH_2w1wpvaQUPstb-Bw"},{url:"/_next/static/chunks/app/(router)/add/page-a77d7554a2057d55.js",revision:"D_QH_2w1wpvaQUPstb-Bw"},{url:"/_next/static/chunks/app/(router)/expense/page-ff0cf84c8ba67037.js",revision:"D_QH_2w1wpvaQUPstb-Bw"},{url:"/_next/static/chunks/app/(router)/friend/page-0681de5cb14c92a3.js",revision:"D_QH_2w1wpvaQUPstb-Bw"},{url:"/_next/static/chunks/app/(router)/group/page-9b31fbf8a9666021.js",revision:"D_QH_2w1wpvaQUPstb-Bw"},{url:"/_next/static/chunks/app/(router)/layout-c185c2070dd928d9.js",revision:"D_QH_2w1wpvaQUPstb-Bw"},{url:"/_next/static/chunks/app/(router)/page-644f0b4f976f6a09.js",revision:"D_QH_2w1wpvaQUPstb-Bw"},{url:"/_next/static/chunks/app/_not-found/page-50a202315221fd62.js",revision:"D_QH_2w1wpvaQUPstb-Bw"},{url:"/_next/static/chunks/app/api/auth/%5B...nextauth%5D/route-c76daf5c74849c0b.js",revision:"D_QH_2w1wpvaQUPstb-Bw"},{url:"/_next/static/chunks/app/api/trpc/%5Btrpc%5D/route-3f6b1acc32fca989.js",revision:"D_QH_2w1wpvaQUPstb-Bw"},{url:"/_next/static/chunks/app/layout-65f84582b7fce980.js",revision:"D_QH_2w1wpvaQUPstb-Bw"},{url:"/_next/static/chunks/app/manifest.webmanifest/route-1cba1848fd15aa6a.js",revision:"D_QH_2w1wpvaQUPstb-Bw"},{url:"/_next/static/chunks/framework-289b5a20f31bf2b1.js",revision:"D_QH_2w1wpvaQUPstb-Bw"},{url:"/_next/static/chunks/main-094812ef791a00bb.js",revision:"D_QH_2w1wpvaQUPstb-Bw"},{url:"/_next/static/chunks/main-app-da974a6306d5a606.js",revision:"D_QH_2w1wpvaQUPstb-Bw"},{url:"/_next/static/chunks/pages/_app-7e5d4a60281b6427.js",revision:"D_QH_2w1wpvaQUPstb-Bw"},{url:"/_next/static/chunks/pages/_error-77fa64d81664a8ec.js",revision:"D_QH_2w1wpvaQUPstb-Bw"},{url:"/_next/static/chunks/polyfills-42372ed130431b0a.js",revision:"846118c33b2c0e922d7b3a7676f81f6f"},{url:"/_next/static/chunks/webpack-69c67d16c363604a.js",revision:"D_QH_2w1wpvaQUPstb-Bw"},{url:"/_next/static/css/74d14436e2fb3a38.css",revision:"74d14436e2fb3a38"},{url:"/_next/static/media/569ce4b8f30dc480-s.p.woff2",revision:"ef6cefb32024deac234e82f932a95cbd"},{url:"/_next/static/media/ba015fad6dcf6784-s.woff2",revision:"8ea4f719af3312a055caf09f34c89a77"},{url:"/favicon.ico",revision:"7f98bbc43ba0d1dbf3564adf0821a304"}],{ignoreURLParametersMatching:[]}),e.cleanupOutdatedCaches(),e.registerRoute("/",new e.NetworkFirst({cacheName:"start-url",plugins:[{cacheWillUpdate:async({request:e,response:s,event:t,state:a})=>s&&"opaqueredirect"===s.type?new Response(s.body,{status:200,statusText:"OK",headers:s.headers}):s}]}),"GET"),e.registerRoute(/^https:\/\/fonts\.(?:gstatic)\.com\/.*/i,new e.CacheFirst({cacheName:"google-fonts-webfonts",plugins:[new e.ExpirationPlugin({maxEntries:4,maxAgeSeconds:31536e3})]}),"GET"),e.registerRoute(/^https:\/\/fonts\.(?:googleapis)\.com\/.*/i,new e.StaleWhileRevalidate({cacheName:"google-fonts-stylesheets",plugins:[new e.ExpirationPlugin({maxEntries:4,maxAgeSeconds:604800})]}),"GET"),e.registerRoute(/\.(?:eot|otf|ttc|ttf|woff|woff2|font.css)$/i,new e.StaleWhileRevalidate({cacheName:"static-font-assets",plugins:[new e.ExpirationPlugin({maxEntries:4,maxAgeSeconds:604800})]}),"GETLine truncated
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
define(["exports"],(function(t){"use strict";try{self["workbox:core:6.5.4"]&&_()}catch(t){}const e=(t,...e)=>{let s=t;return e.length>0&&(s+=` :: ${JSON.stringify(e)}`),s};class s extends Error{constructor(t,s){super(e(t,s)),this.name=t,this.details=s}}try{self["workbox:routing:6.5.4"]&&_()}catch(t){}const n=t=>t&&"object"==typeof t?t:{handle:t};class r{constructor(t,e,s="GET"){this.handler=n(e),this.match=t,this.method=s}setCatchHandler(t){this.catchHandler=n(t)}}class i extends r{constructor(t,e,s){super((({url:e})=>{const s=t.exec(e.href);if(s&&(e.origin===location.origin||0===s.index))return s.slice(1)}),e,s)}}class a{constructor(){this.t=new Map,this.i=new Map}get routes(){return this.t}addFetchListener(){self.addEventListener("fetch",(t=>{const{request:e}=t,s=this.handleRequest({request:e,event:t});s&&t.respondWith(s)}))}addCacheListener(){self.addEventListener("message",(t=>{if(t.data&&"CACHE_URLS"===t.data.type){const{payload:e}=t.data,s=Promise.all(e.urlsToCache.map((e=>{"string"==typeof e&&(e=[e]);const s=new Request(...e);return this.handleRequest({request:s,event:t})})));t.waitUntil(s),t.ports&&t.ports[0]&&s.then((()=>t.ports[0].postMessage(!0)))}}))}handleRequest({request:t,event:e}){const s=new URL(t.url,location.href);if(!s.protocol.startsWith("http"))return;const n=s.origin===location.origin,{params:r,route:i}=this.findMatchingRoute({event:e,request:t,sameOrigin:n,url:s});let a=i&&i.handler;const o=t.method;if(!a&&this.i.has(o)&&(a=this.i.get(o)),!a)return;let c;try{c=a.handle({url:s,request:t,event:e,params:r})}catch(t){c=Promise.reject(t)}const h=i&&i.catchHandler;return c instanceof Promise&&(this.o||h)&&(c=c.catch((async n=>{if(h)try{return await h.handle({url:s,request:t,event:e,params:r})}catch(t){t instanceof Error&&(n=t)}if(this.o)return this.o.handle({url:s,request:t,event:e});throw n}))),c}findMatchingRoute({url:t,sameOrigin:e,request:s,event:n}){const r=this.t.get(s.method)||[];for(const i of r){let r;const a=i.match({url:t,sameOrigin:e,request:s,event:n});if(a)return r=a,(Array.isArray(r)&&0===r.length||a.constructor===Object&&0===Object.keys(a).length||"boolean"==typeof a)&&(r=void 0),{route:i,params:r}}return{}}setDefaultHandler(t,e="GET"){this.i.set(e,n(t))}setCatchHandler(t){this.o=n(t)}registerRoute(t){this.t.has(t.method)||this.t.set(t.method,[]),this.t.get(t.method).push(t)}unregisterRoute(t){if(!this.t.has(t.method))throw new s("unregister-route-but-not-found-with-method",{method:t.method});const e=this.t.get(t.method).indexOf(t);if(!(e>-1))throw new s("unregister-route-route-not-registered");this.t.get(t.method).splice(e,1)}}let o;const c=()=>(o||(o=new a,o.addFetchListener(),o.addCacheListener()),o);function h(t,e,n){let a;if("string"==typeof t){const s=new URL(t,location.href);a=new r((({url:t})=>t.href===s.href),e,n)}else if(t instanceof RegExp)a=new i(t,e,n);else if("function"==typeof t)a=new r(t,e,n);else{if(!(t instanceof r))throw new s("unsupported-route-type",{moduleName:"workbox-routing",funcName:"registerRoute",paramName:"capture"});a=t}return c().registerRoute(a),a}try{self["workbox:strategies:6.5.4"]&&_()}catch(t){}const u={cacheWillUpdate:async({response:t})=>200===t.status||0===t.status?t:null},l={googleAnalytics:"googleAnalytics",precache:"precache-v2",prefix:"workbox",runtime:"runtime",suffix:"undefined"!=typeof registration?registration.scope:""},f=t=>[l.prefix,t,l.suffix].filter((t=>t&&t.length>0)).join("-"),w=t=>t||f(l.precache),d=t=>t||f(l.runtime);function p(t,e){const s=new URL(t);for(const t of e)s.searchParams.delete(t);return s.href}class y{constructor(){this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e}))}}const g=new Set;function m(t){return"string"==typeof t?new Request(t):t}class v{constructor(t,e){this.h={},Object.assign(this,e),this.event=e.event,this.u=t,this.l=new y,this.p=[],this.m=[...t.plugins],this.v=new Map;for(const t of this.m)this.v.set(t,{});this.event.waitUntil(this.l.promise)}async fetch(t){const{event:e}=this;let n=m(t);if("navigate"===n.mode&&e instanceof FetchEvent&&e.preloadResponse){const t=await e.preloadResponse;if(t)return t}const r=this.hasCallback("fetchDidFail")?n.clone():null;try{for(const t of this.iterateCallbacks("requestWillFetch"))n=await t({request:n.clone(),event:e})}catch(t){if(t instanceof Error)throw new s("plugin-error-request-will-fetch",{thrownErrorMessage:t.message})}const i=n.clone();try{let t;t=await fetch(n,"navigate"===n.mode?void 0:this.u.fetchOptions);for(const s of this.iterateCallbacks("fetchDidSucceed"))t=await s({event:e,request:i,response:t});return t}catch(t){throw r&&await this.runCallbacks("fetchDidFail",{error:t,event:e,originalRequest:r.clone(),request:i.clone()}),t}}async fetchAndCachePut(t){const e=await this.fetch(t),s=e.clone();return this.waitUntil(this.cachePut(t,s)),e}async cacheMatch(t){const e=m(t);let s;const{cacheName:n,matchOptions:r}=this.u,i=await this.getCacheKey(e,"read"),a=Object.assign(Object.assign({},r),{cacheName:n});s=await caches.match(i,a);for(constLine truncated
|
||||||
+1
-1
@@ -4,7 +4,7 @@ type AppConfig = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const appConfig: AppConfig = {
|
export const appConfig: AppConfig = {
|
||||||
name: "Betterwise",
|
name: "Bettesplit",
|
||||||
navigator: [
|
navigator: [
|
||||||
{
|
{
|
||||||
name: "Home",
|
name: "Home",
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
import AddFriendDrawer from "@/app/_components/friend/add-friend-drawer";
|
import AddFriendDrawer from "@/app/_components/friend/add-friend-drawer";
|
||||||
import FriendList from "@/app/_components/friend/friend-list";
|
import FriendList from "@/app/_components/friend/friend-list";
|
||||||
import Header from "@/components/header";
|
import Header from "@/components/header";
|
||||||
|
import { auth } from "@/server/auth";
|
||||||
import { api, HydrateClient } from "@/trpc/server";
|
import { api, HydrateClient } from "@/trpc/server";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
void api.friend.getAll.prefetch();
|
const session = await auth();
|
||||||
|
if (session?.user) void api.friend.getAll.prefetch();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<HydrateClient>
|
<HydrateClient>
|
||||||
|
|||||||
@@ -4,13 +4,14 @@ import React from "react";
|
|||||||
export default function FriendRequestButton({}: {}) {
|
export default function FriendRequestButton({}: {}) {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Button
|
{/* <Button
|
||||||
variant={requestedBy === "me" ? "destructive" : "outline"}
|
variant={requestedBy === "me" ? "destructive" : "outline"}
|
||||||
className="ml-auto"
|
className="ml-auto"
|
||||||
size="sm"
|
size="sm"
|
||||||
>
|
>
|
||||||
{requestedBy === "me" ? "Cancel" : "Accept"}
|
{requestedBy === "me" ? "Cancel" : "Accept"}
|
||||||
</Button>
|
</Button> */}
|
||||||
|
friendRequestButton
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
// "use client";
|
||||||
|
// import React, { useEffect, useState } from "react";
|
||||||
|
// export function usePwaInstallStatus() {
|
||||||
|
// const [isStandalone, setIsStandalone] = useState(false);
|
||||||
|
// const [isIOS, setIsIOS] = useState(false);
|
||||||
|
// const [isAndroid, setIsAndroid] = useState(false);
|
||||||
|
|
||||||
|
// useEffect(() => {
|
||||||
|
// const userAgent =
|
||||||
|
// navigator.userAgent || navigator.vendor || (window as any).opera;
|
||||||
|
|
||||||
|
// // iOS detection
|
||||||
|
// const iOS = /iPad|iPhone|iPod/.test(userAgent) && !(window as any).MSStream;
|
||||||
|
// setIsIOS(iOS);
|
||||||
|
|
||||||
|
// // Android detection
|
||||||
|
// const android = /android/i.test(userAgent);
|
||||||
|
// setIsAndroid(android);
|
||||||
|
|
||||||
|
// // PWA "standalone" mode detection (works for both iOS & Android)
|
||||||
|
// const isInStandaloneMode =
|
||||||
|
// window.matchMedia("(display-mode: standalone)").matches ||
|
||||||
|
// (navigator as any).standalone === true; // for iOS Safari
|
||||||
|
|
||||||
|
// setIsStandalone(isInStandaloneMode);
|
||||||
|
// }, []);
|
||||||
|
|
||||||
|
// return { isIOS, isAndroid, isStandalone };
|
||||||
|
// }
|
||||||
|
|
||||||
|
// function InstallPrompt() {
|
||||||
|
// const { isIOS, isAndroid, isStandalone } = usePwaInstallStatus();
|
||||||
|
// const [deferredPrompt, setDeferredPrompt] = useState<any>(null);
|
||||||
|
|
||||||
|
// useEffect(() => {
|
||||||
|
// const handler = (e: any) => {
|
||||||
|
// e.preventDefault();
|
||||||
|
// setDeferredPrompt(e);
|
||||||
|
// };
|
||||||
|
|
||||||
|
// window.addEventListener("beforeinstallprompt", handler);
|
||||||
|
|
||||||
|
// return () => {
|
||||||
|
// window.removeEventListener("beforeinstallprompt", handler);
|
||||||
|
// };
|
||||||
|
// }, []);
|
||||||
|
|
||||||
|
// const handleInstallClick = () => {
|
||||||
|
// console.log("install clicked");
|
||||||
|
|
||||||
|
// if (deferredPrompt) {
|
||||||
|
// deferredPrompt.prompt();
|
||||||
|
// deferredPrompt.userChoice.then((choiceResult: any) => {
|
||||||
|
// if (choiceResult.outcome === "accepted") {
|
||||||
|
// console.log("User accepted the A2HS prompt");
|
||||||
|
// } else {
|
||||||
|
// console.log("User dismissed the A2HS prompt");
|
||||||
|
// }
|
||||||
|
// setDeferredPrompt(null);
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
// if (isStandalone) {
|
||||||
|
// return null; // Already running as a PWA, no need to show install prompt
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return (
|
||||||
|
// <div className="absolute w-full h-20 z-50 bg-red-500 left-0 flex items-center justify-center right-0 bottom-0 text-white">
|
||||||
|
// {isIOS && <p>Tap "Share" and "Add to Home Screen" to install the app.</p>}
|
||||||
|
// {isAndroid && <button onClick={handleInstallClick}>Install App</button>}
|
||||||
|
// </div>
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
|
// export default function PWAWrapper({
|
||||||
|
// children,
|
||||||
|
// }: {
|
||||||
|
// children: React.ReactNode;
|
||||||
|
// }) {
|
||||||
|
// return (
|
||||||
|
// <>
|
||||||
|
// <InstallPrompt />
|
||||||
|
// {children}
|
||||||
|
// </>
|
||||||
|
// );
|
||||||
|
// }
|
||||||
@@ -5,6 +5,7 @@ import { Geist } from "next/font/google";
|
|||||||
import { Toaster } from "@/components/ui/sonner";
|
import { Toaster } from "@/components/ui/sonner";
|
||||||
import { TRPCReactProvider } from "@/trpc/react";
|
import { TRPCReactProvider } from "@/trpc/react";
|
||||||
import { ThemeProvider } from "@/components/theme-provider";
|
import { ThemeProvider } from "@/components/theme-provider";
|
||||||
|
// import PWAWrapper from "./_components/install-prompt";
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
title: "Create T3 App",
|
title: "Create T3 App",
|
||||||
@@ -30,6 +31,8 @@ export default function RootLayout({
|
|||||||
enableSystem
|
enableSystem
|
||||||
disableTransitionOnChange
|
disableTransitionOnChange
|
||||||
>
|
>
|
||||||
|
{/* <PWAWrapper>
|
||||||
|
</PWAWrapper> */}
|
||||||
{children}
|
{children}
|
||||||
<Toaster position="top-center" />
|
<Toaster position="top-center" />
|
||||||
</ThemeProvider>
|
</ThemeProvider>
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import { appConfig } from "@/app.config";
|
||||||
|
import type { MetadataRoute } from "next";
|
||||||
|
|
||||||
|
export default function manifest(): MetadataRoute.Manifest {
|
||||||
|
return {
|
||||||
|
name: appConfig.name,
|
||||||
|
short_name: "NextPWA",
|
||||||
|
description: "A Progressive Web App built with Next.js",
|
||||||
|
start_url: "/",
|
||||||
|
display: "standalone",
|
||||||
|
background_color: "#ffffff",
|
||||||
|
theme_color: "#000000",
|
||||||
|
icons: [
|
||||||
|
{
|
||||||
|
src: "/icon-192x192.png",
|
||||||
|
sizes: "192x192",
|
||||||
|
type: "image/png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
src: "/icon-512x512.png",
|
||||||
|
sizes: "512x512",
|
||||||
|
type: "image/png",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@ function NavLink({ href, name, icon }: NavLink) {
|
|||||||
asChild
|
asChild
|
||||||
variant={"ghost"}
|
variant={"ghost"}
|
||||||
className={cn(
|
className={cn(
|
||||||
"p-2 size-12 text-muted-foreground/75 flex flex-col gap-2 ",
|
"p-2 size-12 text-muted-foreground/75 flex flex-col gap-2 hover:bg-transparent dark:hover:bg-transparent ",
|
||||||
active && "text-foreground "
|
active && "text-foreground "
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
"use client"
|
"use client";
|
||||||
|
|
||||||
import { useTheme } from "next-themes"
|
import { useTheme } from "next-themes";
|
||||||
import { Toaster as Sonner, ToasterProps } from "sonner"
|
import { Toaster as Sonner, type ToasterProps } from "sonner";
|
||||||
|
|
||||||
const Toaster = ({ ...props }: ToasterProps) => {
|
const Toaster = ({ ...props }: ToasterProps) => {
|
||||||
const { theme = "system" } = useTheme()
|
const { theme = "system" } = useTheme();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Sonner
|
<Sonner
|
||||||
@@ -19,7 +19,7 @@ const Toaster = ({ ...props }: ToasterProps) => {
|
|||||||
}
|
}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
export { Toaster }
|
export { Toaster };
|
||||||
Vendored
File renamed without changes.
@@ -38,6 +38,7 @@ declare module "next-auth" {
|
|||||||
* @see https://next-auth.js.org/configuration/options
|
* @see https://next-auth.js.org/configuration/options
|
||||||
*/
|
*/
|
||||||
export const authConfig = {
|
export const authConfig = {
|
||||||
|
trustHost: true,
|
||||||
providers: [
|
providers: [
|
||||||
DiscordProvider,
|
DiscordProvider,
|
||||||
/**
|
/**
|
||||||
|
|||||||
+38
-38
@@ -1,43 +1,43 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
/* Base Options: */
|
/* Base Options: */
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"target": "es2022",
|
"target": "es2022",
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"moduleDetection": "force",
|
"moduleDetection": "force",
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"verbatimModuleSyntax": true,
|
"verbatimModuleSyntax": true,
|
||||||
|
|
||||||
/* Strictness */
|
/* Strictness */
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"noUncheckedIndexedAccess": true,
|
"noUncheckedIndexedAccess": true,
|
||||||
"checkJs": true,
|
"checkJs": true,
|
||||||
|
|
||||||
/* Bundled projects */
|
/* Bundled projects */
|
||||||
"lib": ["dom", "dom.iterable", "ES2022"],
|
"lib": ["dom", "dom.iterable", "ES2022"],
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
"moduleResolution": "Bundler",
|
"moduleResolution": "Bundler",
|
||||||
"jsx": "preserve",
|
"jsx": "preserve",
|
||||||
"plugins": [{ "name": "next" }],
|
"plugins": [{ "name": "next" }],
|
||||||
"incremental": true,
|
"incremental": true,
|
||||||
|
|
||||||
/* Path Aliases */
|
/* Path Aliases */
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": ["./src/*"]
|
"@/*": ["./src/*"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
".eslintrc.cjs",
|
".eslintrc.cjs",
|
||||||
"next-env.d.ts",
|
"next-env.d.ts",
|
||||||
"**/*.ts",
|
"**/*.ts",
|
||||||
"**/*.tsx",
|
"**/*.tsx",
|
||||||
"**/*.cjs",
|
"**/*.cjs",
|
||||||
"**/*.js",
|
"**/*.js",
|
||||||
".next/types/**/*.ts"
|
".next/types/**/*.ts"
|
||||||
],
|
],
|
||||||
"exclude": ["node_modules"]
|
"exclude": ["node_modules", "public/sw.js", "public/workbox-*.js"]
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user