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

Feature/faq #38

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.github/
README.md
lefthook.yml
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VITE_BASHAWAY_BE_URL=https://api.staging.bashaway.sliitfoss.org
VITE_CORE_BE_URL=
VITE_FIREBASE_CONFIG=
VITE_AZURE_UPLOAD_SAS_TOKEN=
VITE_AZURE_DOWNLOAD_SAS_TOKEN=
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/add-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Add Labels

on:
issues:
types: opened

jobs:
add_labels:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3

- name: add labels
uses: actions-ecosystem/action-add-labels@v1
with:
labels: |
Event Portal
Team/Dev :man_technologist:
63 changes: 63 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
on:
workflow_call:
inputs:
tag:
required: true
type: string
secrets:
GCP_SA_KEY :
required: true
# FRONTEND_URL:
# required: true
# SERVER_URL:
# required: true
# FIREBASE_CONFIG:
# required: true

jobs:
build-push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ inputs.tag }}
# build-args: |
# PUBLIC_FRONTEND_URL=${{ secrets.FRONTEND_URL }}
# PUBLIC_SERVER_URL=${{ secrets.SERVER_URL }}
# PUBLIC_FIREBASE_CONFIG=${{ secrets.FIREBASE_CONFIG }}

cloud-run-deploy:
needs: build-push
runs-on: ubuntu-latest
permissions:
contents: 'read'
id-token: 'write'
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Authenticate with Google Cloud
uses: google-github-actions/auth@v1
with:
credentials_json: '${{ secrets.GCP_SA_KEY }}'

- name: Deploy to Cloud Run
uses: google-github-actions/deploy-cloudrun@v1
with:
service: techevents-web
image: ${{ inputs.tag }}
19 changes: 19 additions & 0 deletions .github/workflows/dev-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Dev Release
run-name: Dev Build and deploy

on:
workflow_dispatch:
push:
branches:
- main
jobs:
build-and-deploy:
name: Dev
uses: ./.github/workflows/deploy.yml
with:
tag: ghcr.io/${{ github.repository }}:${{ github.sha }}-${{ github.run_attempt }}-dev
secrets:
GCP_SA_KEY : ${{ secrets.DEV_GCP_SA_KEY }}
# FRONTEND_URL: ${{ secrets.DEV_FRONTEND_URL }}
# SERVER_URL: ${{ secrets.DEV_SERVER_URL }}
# FIREBASE_CONFIG: ${{ secrets.DEV_FIREBASE_CONFIG }}
42 changes: 42 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Stage 1: Build the React application
FROM node:16-alpine as build

ARG VITE_APP_ENV
ARG VITE_CORE_BE_URL=https://techevents-api-dev-6yykz7rdnq-uc.a.run.app
ARG VITE_FIREBASE_CONFIG
ARG VITE_AZURE_UPLOAD_SAS_TOKEN
ARG VITE_AZURE_DOWNLOAD_SAS_TOKEN
ARG VITE_AZURE_GENERIC_UPLOAD_SAS_TOKEN
ARG VITE_AZURE_STORAGE_ACCOUNT
ARG VITE_AZURE_GENERIC_STORAGE_ACCOUNT
ARG VITE_AZURE_STORAGE_CONTAINER
ARG VITE_SENTRY_DSN
ARG SENTRY_ORG
ARG SENTRY_PROJECT_NAME

RUN npm install -g pnpm

WORKDIR /app

COPY package*.json pnpm-lock.yaml ./

COPY patches /app/patches

RUN pnpm install --ignore-scripts

COPY . .

RUN pnpm run build

# Stage 2: Serve the React application from Nginx
FROM nginx:1.19.0-alpine

COPY --from=build /app/dist /usr/share/nginx/html

# Copy the Nginx configuration file
COPY /nginx/nginx.conf /etc/nginx/conf.d/default.conf

# Expose port 80
EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]
22 changes: 11 additions & 11 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@
as="style" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Race against time with automation" />
<meta property="og:title" content="Bashaway | 2023" />
<meta property="og:description" content="Race against time with automation" />
<meta property="og:image" content="https://portal.bashaway.sliitfoss.org/assets/icons/favicon.svg" />
<meta name="description" content="A unified all in one tech event portal" />
<meta property="og:title" content="Tech Events Portal" />
<meta property="og:description" content="A unified all in one tech event portal" />
<meta property="og:image" content="https://portal.techevents.gdgsrilanka.org/assets/icons/favicon.svg" />
<meta property="og:image:width" content="64" />
<meta property="og:image:height" content="64" />
<meta property="og:image:alt" content="Bashaway Logo" />
<meta property="og:url" content="https://portal.bashaway.sliitfoss.org" />
<meta property="og:image:alt" content="Logo" />
<meta property="og:url" content="https://portal.techevents.gdgsrilanka.org" />
<meta property="og:type" content="website" />
<meta property="og:site_name" content="Bashaway Competitor Portal" />
<meta property="og:site_name" content="Tech Events Portal" />
<meta property="og:locale" content="en_US" />
<meta property="twitter:image" content="https://portal.bashaway.sliitfoss.org/assets/icons/favicon.svg">
<meta property="twitter:title" content="Bashaway Competitor Portal">
<meta property="twitter:description" content="Race against time with automation">
<meta property="twitter:image" content="https://portal.techevents.gdgsrilanka.org/assets/icons/favicon.svg">
<meta property="twitter:title" content="Tech Events Portal">
<meta property="twitter:description" content="A unified all in one tech event portal">
<meta property="twitter:card" content="summary_large_image">
<title>Bashaway | 2023</title>
<title>Techevents.lk</title>
</head>

<body>
Expand Down
9 changes: 9 additions & 0 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
server {
listen 80;
root /usr/share/nginx/html;
index index.html;

location / {
try_files $uri $uri/ $uri.html =404;
}
}
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@
"build": "cross-env NODE_OPTIONS=--max-old-space-size=8192 vite build",
"format": "prettier --write --cache \"**/*.{js,jsx,ts,tsx,md,mdx}\"",
"lint": "eslint . --ext js,jsx,mdx --ignore-path .gitignore --fix --cache --report-unused-disable-directives",
"preview": "vite preview",
"prepare": "lefthook install"
"preview": "vite preview"
},
"dependencies": {
"@azure/storage-blob": "12.15.0",
"@reduxjs/toolkit": "1.9.5",
"@sentry/react": "7.69.0",
"@sliit-foss/bashaway-ui": "0.10.3",
"@sliit-foss/bashaway-ui": "0.12.2",
"async-mutex": "^0.4.0",
"firebase": "10.2.0",
"framer-motion": "10.14.0",
Expand Down
9 changes: 5 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added public/assets/images/cover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/images/gdg-logo.webp
Binary file not shown.
Binary file added public/assets/images/gdglk-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const App = () => {
<Header />
<motion.main
key={location.pathname}
className="w-full max-w-body mx-auto px-8 lg:px-24 flex flex-col items-center relative z-[5] font-inter break-words overflow-x-hidden pt-[calc(70px+64px)] xs:pt-[calc(86px+64px)] pb-[64px]"
className="w-full max-w-body mx-auto px-8 lg:px-24 flex flex-col items-center relative z-[5] font-inter break-words overflow-x-hidden pt-[calc(70px+64px)] xs:pt-[calc(86px+64px)] pb-[64px]"
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0, transition: { duration: 0.3 } }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
import { Plus } from "lucide-react";
import { useNavigate } from "react-router-dom";
import { twMerge } from "tailwind-merge";
import { useGetSettingsQuery } from "@/store/api";
import { downloadFile } from "@/utils";
import { AnimatedSwitcher, Button } from "@sliit-foss/bashaway-ui/components";

const ActionButtons = ({ loading = false, question, className, buttonClassName }) => {
const { data: { data: settings } = {}, isLoading } = useGetSettingsQuery();

const ActionButtons = ({ loading = false, challenge, className, buttonClassName }) => {
const navigate = useNavigate();
return (
<div className={twMerge("flex flex-col md:flex-row gap-3 mt-1", className)}>
<Button
className={twMerge("py-2 md:py-1.5", buttonClassName)}
disabled={isLoading || new Date(settings?.submission_deadline) < new Date()}
loading={loading}
onClick={() => document.getElementById("file-upload").click()}
>
Expand All @@ -28,16 +24,16 @@ const ActionButtons = ({ loading = false, question, className, buttonClassName }
<Button
variant="secondary"
className={twMerge("bg-transparent", buttonClassName)}
onClick={() => downloadFile(question.codebase_url)}
disabled={!question}
onClick={() => downloadFile(challenge.codebase_url)}
disabled={!challenge}
>
Download codebase
</Button>
<Button
variant="secondary"
className={twMerge("bg-transparent", buttonClassName)}
disabled={!question}
onClick={() => navigate(`/questions/${question._id}/submissions`)}
disabled={!challenge}
onClick={() => navigate(`/challenges/${challenge._id}/submissions`)}
>
View submissions
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@ import { challengeColor } from "@/utils";
import { Tooltip, TooltipContent, TooltipTrigger } from "@sliit-foss/bashaway-ui/components";
import { Body3, Footnote } from "@sliit-foss/bashaway-ui/typography";

export { default as QuestionGridSkeleton } from "./skeleton";
export { default as ChallengeGridSkeleton } from "./skeleton";

export const Question = ({ question }) => {
const cardStyles = useMemo(() => challengeColor(question), [question]);
export const Challenge = ({ challenge }) => {
const cardStyles = useMemo(() => challengeColor(challenge), [challenge]);

const cleanedDescription = useMemo(() => {
if (question.description) {
return question.description
if (challenge.description) {
return challenge.description
.replace(/^#+\s.*$/gm, "")
.trim()
.split("\n")[0];
}
return "";
}, [question.description]);
}, [challenge.description]);

const SubmitIcon = question.submitted ? CheckCircle2 : XCircle;
const SubmitIcon = challenge.submitted ? CheckCircle2 : XCircle;

return (
<Link
to={`/questions/${question._id}`}
to={`/challenges/${challenge._id}`}
className="group h-full w-full animated-border text-border from-black/20 to-border p-5 rounded-3xl"
>
<div
Expand All @@ -37,28 +37,28 @@ export const Question = ({ question }) => {
)}
>
<div className="title flex justify-between gap-5">
<Body3 className="font-bold transition-all duration-medium">{question.name}</Body3>
<Body3 className="font-bold transition-all duration-medium">{challenge.name}</Body3>
<div className="w-7">
<Tooltip>
<TooltipTrigger>
{" "}
<SubmitIcon className="w-[1.35rem] h-[1.35rem] mt-[3px] md:mt-1 sm:w-6 sm:h-6 opacity-90" />
</TooltipTrigger>
<TooltipContent className="border-transparent px-[1.28rem] py-[0.41rem] font-semibold bg-black text-white rounded-full">
{question.submitted ? "Submitted" : "Not Submitted"}
{challenge.submitted ? "Submitted" : "Not Submitted"}
</TooltipContent>
</Tooltip>
</div>
</div>
<ReactMarkdown className="markdown [&>p]:font-semibold line-clamp-3">{cleanedDescription}</ReactMarkdown>
<div className="flex flex-wrap gap-3 [&>span]:px-3 [&>span]:py-2 [&>span]:rounded-lg [&>span]:transition-all [&>span]:duration-medium">
<Footnote>{startCase(question.difficulty.toLowerCase())}</Footnote>
<Footnote>{question.max_score}PT</Footnote>
{question.constraints?.length && <Footnote>{question.constraints?.join(", ")}</Footnote>}
<Footnote>{startCase(challenge.difficulty.toLowerCase())}</Footnote>
<Footnote>{challenge.max_score}PT</Footnote>
{challenge.constraints?.length && <Footnote>{challenge.constraints?.join(", ")}</Footnote>}
</div>
</div>
</Link>
);
};

export default Question;
export default Challenge;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Skeleton } from "@sliit-foss/bashaway-ui/components";

const QuestionGridSkeleton = ({ className }) => {
const ChallengeGridSkeleton = ({ className }) => {
return (
<div className={className}>
{Array.from({ length: 6 }).map((_, i) => (
Expand Down Expand Up @@ -32,4 +32,4 @@ const QuestionGridSkeleton = ({ className }) => {
);
};

export default QuestionGridSkeleton;
export default ChallengeGridSkeleton;
Loading
Loading