Skip to content

Commit

Permalink
Fixed(partially to buildable with warnings) type and IndexedDB enviro…
Browse files Browse the repository at this point in the history
…nment errors
  • Loading branch information
Prathamsahu52 committed Dec 26, 2023
1 parent 05ebf1a commit dbdea30
Show file tree
Hide file tree
Showing 16 changed files with 195 additions and 63 deletions.
67 changes: 67 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
FROM node:18-alpine AS base

# Install dependencies only when needed
FROM base AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app

# Install dependencies based on the preferred package manager
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
RUN \
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
elif [ -f package-lock.json ]; then npm ci; \
elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \
else echo "Lockfile not found." && exit 1; \
fi


# Rebuild the source code only when needed
FROM base AS builder
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

# RUN yarn build

# If using npm comment out above and use below instead
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 3000

ENV PORT 3000
# set hostname to localhost
ENV HOSTNAME "0.0.0.0"

# server.js is created by next build from the standalone output
# https://nextjs.org/docs/pages/api-reference/next-config-js/output
CMD ["node", "server.js"]
10 changes: 5 additions & 5 deletions app/(landing)/components/layout/navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ const Navigation: React.FC = () => {

return (
<HStack spacing="0" flexShrink={0}>
{siteConfig.header.links.map(({ href, id, ...props }, i) => {
{/* {siteConfig.header.links.map(({ id, ...props }, i) => {
return (
<NavLink
display={["none", null, "block"]}
href={href || `/#${id}`}
// href={href || `/#${id}`}
key={i}
isActive={
!!(
(id && activeId === id) ||
(href && !!router.asPath.match(new RegExp(href)))
(id && activeId === id)
// (href && !!router.asPath.match(new RegExp(href)))
)
}
{...props}
Expand All @@ -53,7 +53,7 @@ const Navigation: React.FC = () => {
{props.label}
</NavLink>
);
})}
})} */}

<ThemeToggle />

Expand Down
4 changes: 2 additions & 2 deletions app/(landing)/components/mobile-nav/mobile-nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export function MobileNavContent(props: MobileNavContentProps) {
<CloseButton ref={closeBtnRef} onClick={onClose} />
</HStack>
</Flex>
<Stack alignItems="stretch" spacing="0">
{/* <Stack alignItems="stretch" spacing="0">
{siteConfig.header.links.map(
({ href, id, label, ...props }, i) => {
return (
Expand All @@ -143,7 +143,7 @@ export function MobileNavContent(props: MobileNavContentProps) {
)
}
)}
</Stack>
</Stack> */}
</Box>
</Flex>
</motion.div>
Expand Down
3 changes: 0 additions & 3 deletions components/Hearts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ function Hearts() {
))}
</div>
</div>



</div>
);
}
Expand Down
5 changes: 4 additions & 1 deletion components/matchedResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ const Results = () => {

return (
<div>
{Matches.map((student) => (
{/* {Matches.map((student) => (
// <MatchedCard
// key={student.i}
// student={student}
// matched
// />
<div>{student.i}</div>
))} */}
{Matches.map((student) => (
<div key={student.i}>{student.i}</div>
))}
</div>
);
Expand Down
10 changes: 8 additions & 2 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
/** @type {import('next').NextConfig} */
const nextConfig = {}
const nextConfig = {
eslint: {
ignoreDuringBuilds: true,
},
output: 'standalone'
}

module.exports = nextConfig

Expand All @@ -13,4 +18,5 @@ module.exports = {
env: {
SERVER_IP: SERVER_IP,
},
};
};

10 changes: 10 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: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"autoprefixer": "latest",
"eslint": "latest",
"eslint-config-next": "latest",
"fake-indexeddb": "^5.0.1",
"postcss": "latest",
"tailwindcss": "latest",
"typescript": "latest"
Expand All @@ -45,4 +46,4 @@
"main": "next.config.js",
"author": "",
"license": "ISC"
}
}
1 change: 1 addition & 0 deletions pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export default class Document extends NextDocument {
<Html lang="en">
<Head>
<link rel="manifest" href="/static/favicons/manifest.json" />
<link rel="apple-touch-icon" href="/static/favicons/apple-touch-icon.png" />
</Head>
<body>
<ColorModeScript initialColorMode={theme.config.initialColorMode} />
Expand Down
60 changes: 30 additions & 30 deletions pages/credits.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,32 @@ import Image from "next/image"
import { BsLinkedin, BsGithub } from "react-icons/bs"
import "../styles/credits.css"
import Clear from "@/components/clear"
const CreditCard = ({ check }) => {
return (
<div className="credit-card">
<div>
<Image
src="/Dog.jpg"
width={140}
height={140}
alt="Profile"
className="credit-image"
/>
</div>
<div className="credit-sec2">
<p className="credits-text">Pratham Sahu</p>
{check && <p>Coordinator</p>}

</div>
<div className="centered">
<BsLinkedin className="icons" />
<BsGithub className="icons" />
</div>


</div>
)
}
// const CreditCard = ({ check }) => {
// return (
// <div className="credit-card">
// <div>
// <Image
// src="/Dog.jpg"
// width={140}
// height={140}
// alt="Profile"
// className="credit-image"
// />
// </div>
// <div className="credit-sec2">
// <p className="credits-text">Pratham Sahu</p>
// {check && <p>Coordinator</p>}

// </div>
// <div className="centered">
// <BsLinkedin className="icons" />
// <BsGithub className="icons" />
// </div>


// </div>
// )
// }
const Credits = () => {
return (
<div className="credits section_padding">
Expand All @@ -36,8 +36,8 @@ const Credits = () => {
<div className="credits-sec1">


<CreditCard check={true} />
<CreditCard check={true} />
{/* <CreditCard check={true} />
<CreditCard check={true} /> */}

</div>

Expand All @@ -46,13 +46,13 @@ const Credits = () => {
<div>
<h1 className="credit-font">Other Contributors</h1>
<div className="credits-sec1">
<CreditCard check={false} />
{/* <CreditCard check={false} />
<CreditCard check={false} />
<CreditCard check={false} />
<CreditCard check={false} />
<CreditCard check={false} />
<CreditCard check={false} /> */}

</div>

Expand Down
2 changes: 1 addition & 1 deletion pages/dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ const New = () => {
</div>
{user && <div className="detail">
<div className="details-text-name">{user?.n}</div>
<div className="details-text" >{user?.d}</div>
{/* <div className="details-text" >{user?.d}</div> */}
<div className="details-text" >{user?.i}</div>
{!hearts_submitted ? (
<motion.div
Expand Down
34 changes: 32 additions & 2 deletions pages/result.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,30 @@ import Results from "@/components/matchedResults";
import Link from "next/link";
import { search_students, Student } from "@/utils/API_Calls/search";
import { get_result } from "@/utils/API_Calls/get_results";
import { useRouter } from "next/router"
import styles from "../styles/login.module.css";



const ResultPage = () => {

useEffect(() => {
const show_result = async() => {
await get_result();
for(let j=0; j < Matched_Ids.length; j++) {
const data: Array<Student> = search_students(Matched_Ids[j]);
if(!data.length) {
return;
}
const student = data[0];
setMatches(student)
}
}
show_result();
}, [])

const router = useRouter()

const stylesss = {
backgroundImage: `url("https://home.iitk.ac.in/~${user?.u}/dp"), url("https://oa.cc.iitk.ac.in/Oa/Jsp/Photo/${user?.i}_0.jpg"), url("/dummy.png")`,
};
Expand All @@ -30,7 +51,7 @@ const ResultPage = () => {
</div>
{user && <div className="detail">
<div className="details-text-name">{user?.n}</div>
<div className="details-text" >{user?.d}</div>
{/* <div className="details-text" >{user?.d}</div> */}
<div className="details-text" >{user?.i}</div>
</div>}

Expand All @@ -53,7 +74,16 @@ const ResultPage = () => {
<h1>Results Yet to be Published</h1>
</div>
}
<Link href="/dashboard" style={{ color: "white" , fontSize : "20px"}}>Back</Link>
<motion.div
whileHover={{ scale: 1.1 }}
className={styles["login-submit-button"]}
whileTap={{ scale: 0.9 }}
onClick={() => router.push(`/dashboard`)}
style={{ color: "black" }}
>
Back
</motion.div>

</div>
</div>
<Clear />
Expand Down
2 changes: 1 addition & 1 deletion utils/API_Calls/Send_Heart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { PubK, Gender, ReturnHearts, Set_Submit } from "../UserData"
import { returnHearts } from "./returnHearts"
const SERVER_IP = process.env.SERVER_IP

let PublicKeys;
let PublicKeys: any[] = [];
let isPubliKAvail = false;


Expand Down
1 change: 1 addition & 0 deletions utils/API_Calls/get_results.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const get_result = async() => {
throw new Error(`HTTP Error: ${res.status} - ${res.statusText}`);
}
const res_json = await res.json()
console.log(res_json)
if(res_json.matches){
setAdminPublished(true)
matchedId = res_json.matches as string[]
Expand Down
Loading

0 comments on commit dbdea30

Please sign in to comment.