Skip to content

Commit

Permalink
Merge branch 'dev' into authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
incredible-phoenix246 authored Jul 30, 2024
2 parents a4dff95 + 7b58356 commit 845552d
Show file tree
Hide file tree
Showing 25 changed files with 1,199 additions and 45 deletions.
93 changes: 93 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "dev", "devops", "main", "staging" ]
pull_request:
branches: [ "dev", "devops", "main", "staging" ]
schedule:
- cron: '35 14 * * 1'

jobs:
analyze:
name: Analyze (${{ matrix.language }})
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners (GitHub.com only)
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
# required for all workflows
security-events: write

# required to fetch internal or private CodeQL packs
packages: read

# only required for workflows in private repositories
actions: read
contents: read

strategy:
fail-fast: false
matrix:
include:
- language: javascript-typescript
build-mode: none
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
# Use `c-cpp` to analyze code written in C, C++ or both
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

# If the analyze step fails for one of the languages you are analyzing with
# "We were unable to automatically build your code", modify the matrix above
# to set the build mode to "manual" for that language. Then modify this step
# to build your code.
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
- if: matrix.build-mode == 'manual'
shell: bash
run: |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
echo ' make bootstrap'
echo ' make release'
exit 1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
20 changes: 11 additions & 9 deletions src/app/dashboard/(admin)/_components/layout/logo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@ const DashboardLogo = () => {
return (
<Link
href="/"
className="flex w-full max-w-[24px] items-center justify-center gap-2.5 py-[14px] md:justify-start"
className="flex w-full items-center justify-center gap-2.5 py-[14px] md:justify-start"
>
<Image
src="/logo/logo.png"
alt="Hgn boiler plate logo"
height={24}
width={24}
data-testid="admin-logo"
className="h-full w-full object-contain"
/>
<div>
<Image
src="/logo/logo.png"
alt="Hgn boiler plate logo"
height={24}
width={24}
data-testid="admin-logo"
className="h-full w-full object-contain"
/>
</div>
<span
className="neutral-dark hidden text-2xl font-semibold md:block"
data-testid="admin-logo-text"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {
import Link from "next/link";
import { usePathname } from "next/navigation";

import DashboardLogo from "~/app/dashboard/(admin)/_components/layout/logo";
import UnreadNotificationCard from "~/app/dashboard/(admin)/_components/unread-notification-card/UnreadNotificationCard";
import Logo from "~/components/common/logo";
import { Avatar, AvatarFallback, AvatarImage } from "~/components/ui/avatar";
import {
Popover,
Expand Down Expand Up @@ -47,28 +47,28 @@ const UserNavbar = () => {
const currentPath = pathname?.split("/")[2];
return (
<nav
className="border-b-[0.5px] border-border bg-background px-5 py-2.5 md:left-[220px] lg:left-[252px]"
className="bg-white px-5 py-2.5 md:left-[220px] lg:left-[252px]"
role="navbar"
>
<div className="flex items-center justify-between gap-2">
<div className="flex w-full max-w-[470px] justify-between gap-1">
<div className="flex w-full max-w-[200px] items-center justify-start gap-1">
<Menu className="h-[18px] w-[18px] text-neutral-dark-2 transition-all duration-300 hover:text-neutral-dark-2/50" />
<Logo />
<div className="flex gap-[50px]">
<div className="flex w-full items-center justify-start gap-[15px]">
<Menu className="h-[30px] w-[30px] text-neutral-dark-2 transition-all duration-300 hover:text-neutral-dark-2/50" />
<DashboardLogo />
</div>
<div className="flex w-full max-w-[290px] items-center justify-between gap-1">
<div className="hidden items-center justify-between gap-[22px] lg:flex">
{navlinks.map((item, index) => (
<Link
key={index}
href={item.link}
className={`text-sm font-bold transition-all duration-200 hover:text-primary ${currentPath === item.id ? "text-primary" : "text-neutral-dark-2"}`}
className={`text-xs font-bold transition-all duration-200 hover:text-primary ${currentPath === item.id ? "text-primary" : "text-neutral-dark-2"}`}
>
{item.route}
</Link>
))}
</div>
</div>
<div className="flex w-full max-w-[440px] items-center justify-between gap-2 bg-[#FDFDFD]">
<div className="flex items-center justify-between gap-2 bg-[#FDFDFD]">
<div className="flex h-10 items-center justify-between gap-2 rounded-[6px] border border-border bg-white px-3 text-sm font-normal placeholder:text-sm">
<SearchIcon
data-testid="search"
Expand Down
2 changes: 1 addition & 1 deletion src/app/dashboard/(user-dashboard)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default function AdminLayout({
return (
<div className="grid grid-rows-[auto_1fr]">
<UserNavbar />
<div className="relative w-full bg-white px-2 max-lg:overflow-hidden xl:px-4">
<div className="relative mx-auto w-full bg-white px-2 max-lg:overflow-hidden xl:px-4">
<Suspense>{children}</Suspense>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
import { X } from "lucide-react";
import React, { useState } from "react";
import { UseFormReturn } from "react-hook-form";

import BlurImage from "~/components/miscellaneous/blur-image";
import { Button } from "~/components/ui/button";
import { cn } from "~/lib/utils";
import { EditProduct } from "../../_components/schema/schema";

type Properties = {
form: UseFormReturn<EditProduct>;
name: string;
};
const handleImageChange = (event: React.ChangeEvent<HTMLInputElement>) => {
event.preventDefault();
};
const ProjectLogo = ({ form, name }: Properties) => {
const [isDragging, setIsDragging] = useState(false);

const projectLogo = form.getValues("media");

const handleDrop = (event: React.DragEvent<HTMLDivElement>) => {
event.preventDefault();
event.stopPropagation();

const target = event.dataTransfer.files[0] as File;

if (target.type === "image/gif") {
return name;
}
const event_data = {
target: {
files: event.dataTransfer.files,
},
};
handleImageChange(
event_data as unknown as React.ChangeEvent<HTMLInputElement>,
);
setIsDragging(false);
};

return (
<div className="relative grid h-full w-[inherit] place-items-center rounded-xl bg-[#FAFAFA]">
<div
data-upload
className="flexx absolute inset-0 z-10 hidden items-center justify-center rounded-xl bg-white/30 text-black"
>
<div className="grid h-full w-full place-items-center rounded-xl bg-white/80 uppercase backdrop-blur-xl">
<p className="items-center md:flex md:flex-col">
<span className="animate-pulse md:text-xs">Uploading...</span>{" "}
<b>10%</b>
</p>
</div>
</div>

{isDragging && (
<div className="pointer-events-none absolute inset-0 z-20 grid h-full w-full scale-95 place-items-center rounded-xl border-2 border-dashed border-white bg-white/20 backdrop-blur-xl">
<p className="text-xl text-white">Drop to upload</p>
</div>
)}

{projectLogo.url && typeof projectLogo.url === "string" ? (
<div className="absolute inset-0 h-full w-full rounded-xl">
<div className="h-full w-full overflow-hidden rounded-xl">
<BlurImage
src={projectLogo.url}
width={500}
height={500}
alt="nft"
className={cn(
"size-full object-cover transition-all duration-300",
)}
/>
</div>
<Button
disabled={false}
variant={"ghost"}
size={"icon"}
type="button"
className="absolute right-1 top-1 rounded-full bg-black/40 p-1 backdrop-blur-xl hover:bg-red-500 hover:text-white disabled:cursor-not-allowed disabled:bg-black/40 md:-right-1 md:-top-1 md:bg-white/20 md:disabled:bg-white/20"
>
<X className="size-8 min-[500px]:size-10" />
</Button>
</div>
) : (
<div
onDrop={handleDrop}
onDragOver={(event) => {
event.preventDefault();
event.stopPropagation();
setIsDragging(true);
}}
onDragLeave={(event) => {
event.preventDefault();
event.stopPropagation();
setIsDragging(false);
}}
className="grid h-full w-full place-items-center"
>
<label
className="flex h-full w-full cursor-pointer flex-col items-center justify-center gap-y-2 text-neutral-dark-1 hover:text-black"
htmlFor={`media`}
>
<Button
type="button"
variant={"secondary"}
size={"sm"}
className="pointer-events-none flex !h-[32px] items-center bg-white text-sm text-[#0F172A] shadow-[0px_1px_18px_0px_rgba(10,_57,_176,_0.12)]"
>
Upload New
</Button>
<p className="text-xs md:text-sm">Add Image or drag it here</p>
</label>
<input
type="file"
hidden
accept=" image/*"
name={`media`}
id={`media`}
onChange={handleImageChange}
/>
</div>
)}
</div>
);
};

export default ProjectLogo;
16 changes: 16 additions & 0 deletions src/app/dashboard/(user-dashboard)/products/[productId]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { notFound } from "next/navigation";

import ProductDetailsContent from "./product-details-content";

const ProductDetailsPage = async ({
params,
}: {
params: { productId: string };
}) => {
const id = params.productId;
if (!id) return notFound();

return <ProductDetailsContent productId={id} />;
};

export default ProductDetailsPage;
Loading

0 comments on commit 845552d

Please sign in to comment.