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

11 integrate helmetjs #20

Closed
wants to merge 9 commits into from
Closed
30 changes: 1 addition & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1 @@
# Create T3 App

This is a [T3 Stack](https://create.t3.gg/) project bootstrapped with `create-t3-app`.

## What's next? How do I make an app with this?

We try to keep this project as simple as possible, so you can start with just the scaffolding we set up for you, and add additional things later when they become necessary.

If you are not familiar with the different technologies used in this project, please refer to the respective docs. If you still are in the wind, please join our [Discord](https://t3.gg/discord) and ask for help.

- [Next.js](https://nextjs.org)
- [NextAuth.js](https://next-auth.js.org)
- [Prisma](https://prisma.io)
- [Drizzle](https://orm.drizzle.team)
- [Tailwind CSS](https://tailwindcss.com)
- [tRPC](https://trpc.io)

## Learn More

To learn more about the [T3 Stack](https://create.t3.gg/), take a look at the following resources:

- [Documentation](https://create.t3.gg/)
- [Learn the T3 Stack](https://create.t3.gg/en/faq#what-learning-resources-are-currently-available) — Check out these awesome tutorials

You can check out the [create-t3-app GitHub repository](https://github.com/t3-oss/create-t3-app) — your feedback and contributions are welcome!

## How do I deploy this?

Follow our deployment guides for [Vercel](https://create.t3.gg/en/deployment/vercel), [Netlify](https://create.t3.gg/en/deployment/netlify) and [Docker](https://create.t3.gg/en/deployment/docker) for more information.
# Info Support Tech Survey
74 changes: 74 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@
*/
await import("./src/env.js");

const cspHeader = `
default-src 'self';
script-src 'self' 'unsafe-eval' 'unsafe-inline';
style-src 'self' 'unsafe-inline';
img-src 'self' blob: data:;
font-src 'self';
object-src 'none';
base-uri 'self';
form-action 'self';
frame-ancestors 'none';
block-all-mixed-content;
upgrade-insecure-requests;`;

/** @type {import("next").NextConfig} */
const config = {
typescript: {
Expand All @@ -13,6 +26,67 @@ const config = {
ignoreDuringBuilds: true,
},
swcMinify: true,
async headers() {
return [
{
source: "/(.*)",
headers: [
{
key: "X-Frame-Options",
value: "DENY",
},
{
key: "X-Content-Type-Options",
value: "nosniff",
},
{
key: "X-DNS-Prefetch-Control",
value: "off",
},
{
key: "X-Download-Options",
value: "noopen",
},
{
key: "X-Frame-Options",
value: "SAMEORIGIN",
},
{
key: "X-Permitted-Cross-Domain-Policies",
value: "none",
},
{
key: "X-XSS-Protection",
value: "0",
},
{
key: "Referrer-Policy",
value: "no-referrer",
},
{
key: "Cross-Origin-Opener-Policy",
value: "same-origin",
},
{
key: "Cross-Origin-Resource-Policy",
value: "same-origin",
},
{
key: "Origin-Agent-Cluster",
value: "?1",
},
{
key: "Strict-Transport-Security",
value: "max-age=15552000; includeSubDomains",
},
{
key: "Content-Security-Policy",
value: cspHeader.replace(/\n/g, ""),
},
],
},
];
},
};

export default config;
68 changes: 68 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 @@ -18,8 +18,10 @@
"@auth/prisma-adapter": "^1.4.0",
"@hookform/resolvers": "^3.3.4",
"@prisma/client": "^5.10.2",
"@radix-ui/react-avatar": "^1.0.4",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-hover-card": "^1.0.7",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-popover": "^1.0.7",
Expand All @@ -37,6 +39,7 @@
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"cmdk": "^1.0.0",
"lucide-react": "^0.359.0",
"next": "^14.1.0",
"next-auth": "^4.24.6",
"next-themes": "^0.2.1",
Expand Down
1 change: 0 additions & 1 deletion src/app/loading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export default function SkeletonDemo() {
{ id: 1, option: "Disagree" },
{ id: 2, option: "Neutral" },
{ id: 3, option: "Agree" },
{ id: 4, option: "Strongly Agree" },
];

// create 20 dummy questions
Expand Down
7 changes: 5 additions & 2 deletions src/app/thank-you/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { db } from "~/server/db";
import MyComponent from "../../components/download-pdf";
import PdfDownloadButton from "../../components/download-pdf";
import React, { Suspense } from "react";
import { getServerAuthSession } from "~/server/auth";
import { type QuestionResult, type Question } from "~/models/types";
Expand Down Expand Up @@ -65,7 +65,10 @@ const ThankYou = async () => {
</p>
<div className="w-full max-w-3xl">
<Suspense fallback={<div>Loading...</div>}>
<MyComponent userAnswersForRole={transformedData} />
<PdfDownloadButton
userAnswersForRole={transformedData}
session={session!}
/>
</Suspense>
</div>
</div>
Expand Down
24 changes: 24 additions & 0 deletions src/components/button-spinner.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Loader2 } from "lucide-react";

import { Button, type ButtonProps } from "~/components/ui/button";

interface SpinnerButtonProps extends ButtonProps {
state: boolean;
name: string;
}

export const SpinnerButton = ({
state,
name,
...props
}: SpinnerButtonProps) => {
return (
<Button {...props}>
{state ? (
<Loader2 className="h-4 w-4 animate-spin" />
) : (
<span>{name}</span>
)}
</Button>
);
};
Loading