Skip to content

Commit

Permalink
Migrate to client rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
arkadiuszbachorski committed Sep 4, 2024
1 parent 4d84be8 commit b376ba2
Show file tree
Hide file tree
Showing 142 changed files with 3,695 additions and 17,201 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#

.git
.next
.results
scripts
*Dockerfile*
Expand Down
9 changes: 5 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
"/out/**",
"/coverage/**",
"/public/authServiceWorker.js",
"**/jest.config.js",
"**/next.config.js",
"**/postcss.config.js",
"**/tailwind.config.js"
],
Expand Down Expand Up @@ -108,11 +106,14 @@
"error",
{ "allowNumber": true, "allowBoolean": true }
],
"react/no-unescaped-entities": "off"
"react/no-unescaped-entities": "off",
// some tanstack router functions result are thrown, like notFound
"@typescript-eslint/only-throw-error": "off",
"@next/next/no-img-element": "off"
},
"overrides": [
{
"files": ["app/**/*.ts?(x)", "**/*.stories.ts?(x)"],
"files": ["app/**/*.ts?(x)", "**/*.stories.ts?(x)", "vite.config.ts"],
"rules": {
"import/no-default-export": "off"
}
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ jobs:
testscript: test.sh
secrets:
ENV_FILE: |
NEXT_PUBLIC_FIREBASE_API_KEY='${{ secrets.NEXT_PUBLIC_FIREBASE_API_KEY }}'
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN='${{ secrets.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN }}'
NEXT_PUBLIC_FIREBASE_PROJECT_ID='${{ secrets.NEXT_PUBLIC_FIREBASE_PROJECT_ID }}'
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET='${{ secrets.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET }}'
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID='${{ secrets.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID }}'
NEXT_PUBLIC_FIREBASE_APP_ID='${{ secrets.NEXT_PUBLIC_FIREBASE_APP_ID }}'
VITE_PUBLIC_FIREBASE_API_KEY='${{ secrets.VITE_PUBLIC_FIREBASE_API_KEY }}'
VITE_PUBLIC_FIREBASE_AUTH_DOMAIN='${{ secrets.VITE_PUBLIC_FIREBASE_AUTH_DOMAIN }}'
VITE_PUBLIC_FIREBASE_PROJECT_ID='${{ secrets.VITE_PUBLIC_FIREBASE_PROJECT_ID }}'
VITE_PUBLIC_FIREBASE_STORAGE_BUCKET='${{ secrets.VITE_PUBLIC_FIREBASE_STORAGE_BUCKET }}'
VITE_PUBLIC_FIREBASE_MESSAGING_SENDER_ID='${{ secrets.VITE_PUBLIC_FIREBASE_MESSAGING_SENDER_ID }}'
VITE_PUBLIC_FIREBASE_APP_ID='${{ secrets.VITE_PUBLIC_FIREBASE_APP_ID }}'
7 changes: 1 addition & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,9 @@
# testing
/coverage

# next.js
/.next/
/out/

# production
/build
/public/authServiceWorker.js
/dist

# misc
.DS_Store
Expand All @@ -44,7 +40,6 @@ admin-creds.json

# typescript
*.tsbuildinfo
next-env.d.ts

# lint
eslint_report.json
Expand Down
51 changes: 11 additions & 40 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,48 +27,19 @@ WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .

# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry during the build.
ENV NEXT_TELEMETRY_DISABLED 1

ARG NEXT_PUBLIC_FIREBASE_API_KEY
ARG NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN
ARG NEXT_PUBLIC_FIREBASE_PROJECT_ID
ARG NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET
ARG NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID
ARG NEXT_PUBLIC_FIREBASE_APP_ID
ARG VITE_PUBLIC_FIREBASE_API_KEY
ARG VITE_PUBLIC_FIREBASE_AUTH_DOMAIN
ARG VITE_PUBLIC_FIREBASE_PROJECT_ID
ARG VITE_PUBLIC_FIREBASE_STORAGE_BUCKET
ARG VITE_PUBLIC_FIREBASE_MESSAGING_SENDER_ID
ARG VITE_PUBLIC_FIREBASE_APP_ID

RUN npm run build

# Production image, copy all the files and run next
FROM base AS runner
WORKDIR /app

ENV NODE_ENV production
# Uncomment the following line in case you want to disable telemetry during runtime.
# ENV NEXT_TELEMETRY_DISABLED 1

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

COPY --from=builder /app/public ./public

# Set the correct permission for prerender cache
RUN mkdir .next
RUN chown nextjs:nodejs .next

# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

USER nextjs

EXPOSE 80
FROM nginx:stable-alpine

ENV PORT 80
# set hostname to localhost
ENV HOSTNAME "0.0.0.0"
RUN mkdir -p /var/www
COPY --from=base /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf

CMD ["node", "server.js"]
EXPOSE 80
23 changes: 7 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ npm install
Create an `.env.local` file or inject the following environment variables required for the Google Firebase Setup:

```
NEXT_PUBLIC_FIREBASE_API_KEY=
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=
NEXT_PUBLIC_FIREBASE_PROJECT_ID=
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=
NEXT_PUBLIC_FIREBASE_APP_ID=
VITE_PUBLIC_FIREBASE_API_KEY=
VITE_PUBLIC_FIREBASE_AUTH_DOMAIN=
VITE_PUBLIC_FIREBASE_PROJECT_ID=
VITE_PUBLIC_FIREBASE_STORAGE_BUCKET=
VITE_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=
VITE_PUBLIC_FIREBASE_APP_ID=
```

3. Start the Next.js Application
3. Start the Vite Application

```bash
npm run dev
Expand Down Expand Up @@ -94,15 +94,6 @@ You need to configure the OpenID Connect Sign-in provider as follows:
- Issuer (URL): `https://login.stanford.edu`
- Client secret: Client ID obtained from your OIDC configuration from the [Stanford SAML and OIDC Configuration Manager](https://spdb-prod.iam.stanford.edu).

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## License

This project is licensed under the MIT License. See [Licenses](https://github.com/StanfordBDHG/ENGAGE-HF-Web-Frontend/tree/main/LICENSES) for more information.
Expand Down
35 changes: 0 additions & 35 deletions app/(dashboard)/layout.tsx

This file was deleted.

26 changes: 0 additions & 26 deletions app/(dashboard)/users/actions.tsx

This file was deleted.

25 changes: 25 additions & 0 deletions app/ReactQueryClientProvider.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// This source file is part of the Stanford Biodesign Digital Health ENGAGE-HF open-source project
//
// SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md)
//
// SPDX-License-Identifier: MIT
//
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'

Check warning on line 8 in app/ReactQueryClientProvider.tsx

View check run for this annotation

Codecov / codecov/patch

app/ReactQueryClientProvider.tsx#L8

Added line #L8 was not covered by tests
import { type ReactNode } from 'react'

interface ReactQueryClientProviderProps {
children: ReactNode
}

export const queryClient = new QueryClient({
defaultOptions: {
queries: { retry: false },
},
})

Check warning on line 19 in app/ReactQueryClientProvider.tsx

View check run for this annotation

Codecov / codecov/patch

app/ReactQueryClientProvider.tsx#L15-L19

Added lines #L15 - L19 were not covered by tests

export const ReactQueryClientProvider = ({
children,
}: ReactQueryClientProviderProps) => (
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>

Check warning on line 24 in app/ReactQueryClientProvider.tsx

View check run for this annotation

Codecov / codecov/patch

app/ReactQueryClientProvider.tsx#L21-L24

Added lines #L21 - L24 were not covered by tests
)
49 changes: 0 additions & 49 deletions app/layout.tsx

This file was deleted.

25 changes: 0 additions & 25 deletions app/sign-in/SignInForm.tsx

This file was deleted.

19 changes: 0 additions & 19 deletions app/sign-in/layout.tsx

This file was deleted.

18 changes: 0 additions & 18 deletions app/sign-in/page.tsx

This file was deleted.

Loading

0 comments on commit b376ba2

Please sign in to comment.