diff --git a/Dockerfile b/Dockerfile index aa8200d..4da1e50 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,9 +36,11 @@ ENV NODE_ENV production RUN addgroup --system --gid 1001 nodejs RUN adduser --system --uid 1001 nextjs +COPY --from=builder /app/public/* /app/public/ # this file is required for the pdfjs-dist package COPY --from=builder /app/node_modules/pdfjs-dist/build/pdf.worker.min.mjs /app/public/pdf.worker.min.mjs + # Set the correct permission for prerender cache RUN mkdir .next RUN chown nextjs:nodejs .next diff --git a/app/lib/auth.ts b/app/lib/auth.ts index 182fa3f..5c3eb46 100644 --- a/app/lib/auth.ts +++ b/app/lib/auth.ts @@ -3,7 +3,7 @@ import GoogleProvider from 'next-auth/providers/google'; import { Session } from 'next-auth'; import { AuthenticatedUser } from './types/next-auth'; -const authConfig: NextAuthConfig = { +export const authConfig: NextAuthConfig = { callbacks: { // method verifies if the user is logged in or not // -> is called by Next-Auth when the midleware calls the `auth` method (exported below) @@ -45,6 +45,9 @@ const authConfig: NextAuthConfig = { // Note: `jwt` is automatically set to `true` if no database is specified. strategy: 'jwt' }, + pages: { + signIn: '/login', + }, }; export const { auth, handlers: { GET, POST } } = NextAuth(authConfig); diff --git a/app/login/page.tsx b/app/login/page.tsx new file mode 100644 index 0000000..be38e98 --- /dev/null +++ b/app/login/page.tsx @@ -0,0 +1,63 @@ +import { FC } from 'react'; +import { Main } from '@/app/ui/Main'; + +import { authConfig } from "@/app/lib/auth"; +import { SignInButton } from '../ui/SignInButton'; + +export type Provider = { + id: string; + name: string; + type: string; + style: { + logo: string; + bg: string; + text: string; + }; +}; + +export function getProviders(): Provider[] { + const providerKeys: (keyof Provider)[] = ["id", "name", "type", "style"]; + return authConfig.providers.map((provider) => + getKeyValuesFromObject(provider, providerKeys) + ); +} + +function getKeyValuesFromObject(obj: any, keys: (keyof T)[]): T { + return keys.reduce((acc, key) => { + if (obj[key]) { + acc[key] = obj[key]; + } + return acc; + }, {} as T); +} + +const Page:FC = async () => { + + const providers = await getProviders() + + return ( +
+

+ Što je pristiglo? + Što je plaćeno? + Koliki su mi troškovi? +

+

To su pitanja na koje ova jednostavna i besplatna aplikacija daje odgovore ...

+

... isprobajte je i koristite potpuno besplatno!

+ + { + Object.values(providers).map((provider) => ( +
+ +
+ )) + } +
+ +
+ ); +} + +export default Page; \ No newline at end of file diff --git a/app/ui/PageFooter.tsx b/app/ui/PageFooter.tsx index a994244..1ddbc3f 100644 --- a/app/ui/PageFooter.tsx +++ b/app/ui/PageFooter.tsx @@ -8,9 +8,9 @@ export const PageFooter: React.FC = () =>
logo -
Bills Tracker
+
Moje Režije
-

Web app for tracking home utility bills

+

Web aplikacija za vođenje evidencije o pristiglim i plaćenim režijskim troškovima

Home Privacy Policy Terms of Service diff --git a/app/ui/PageHeader.tsx b/app/ui/PageHeader.tsx index 481b88b..b304382 100644 --- a/app/ui/PageHeader.tsx +++ b/app/ui/PageHeader.tsx @@ -3,5 +3,5 @@ import Link from "next/link"; export const PageHeader = () =>
- logo Utility Bills Tracker + logo Moje Režije
\ No newline at end of file diff --git a/app/ui/SignInButton.tsx b/app/ui/SignInButton.tsx new file mode 100644 index 0000000..45b102a --- /dev/null +++ b/app/ui/SignInButton.tsx @@ -0,0 +1,23 @@ +"use client"; + +import { signIn } from "next-auth/react" +import { Button } from "@/app/ui/button"; + +const providerLogo = (provider: {id:string, name:string}) => { + switch(provider.id) { + case "google": return "https://authjs.dev/img/providers/google.svg"; + case "facebook": return "https://authjs.dev/img/providers/facebook.svg"; + case "github": return "https://authjs.dev/img/providers/github.svg"; + case "twitter": return "https://authjs.dev/img/providers/twitter.svg"; + case "email": return "https://authjs.dev/img/providers/email.svg"; + default: return "https://authjs.dev/img/providers/google.svg"; + } +} + +export const SignInButton:React.FC<{ provider: {id:string, name:string} }> = ({ provider }) => + + + diff --git a/docker-compose-deploy.yml b/docker-compose-deploy.yml index f721862..99f7ea5 100644 --- a/docker-compose-deploy.yml +++ b/docker-compose-deploy.yml @@ -9,7 +9,7 @@ networks: services: web-app: - image: utility-bills-tracker:1.16.0 + image: utility-bills-tracker:1.17.0 networks: - traefik-network - mongo-network diff --git a/middleware.ts b/middleware.ts index be88fbd..fa7dc5d 100644 --- a/middleware.ts +++ b/middleware.ts @@ -9,5 +9,5 @@ export default auth; // middleware will call NextAuth's `auth` method, which wil export const config = { // midleware will NOT be called for paths: ['/api/auth/*', '/_next/static/*', '/_next/image*'] - matcher: ['/((?!api|policy|terms|_next/static|_next/image|.*\\.png$).*)'], + matcher: ['/((?!api|policy|terms|_next/static|_next/image|.*\\.png$|.*\\.webm$).*)'], }; \ No newline at end of file diff --git a/public/hero.png b/public/hero.png new file mode 100644 index 0000000..e0c3d13 Binary files /dev/null and b/public/hero.png differ diff --git a/public/screencast.webm b/public/screencast.webm new file mode 100644 index 0000000..3cc7b13 Binary files /dev/null and b/public/screencast.webm differ