Skip to content

Commit

Permalink
Roll out v1.4.0 (#170)
Browse files Browse the repository at this point in the history
* Adding max words length

* Feature/config email testing on local environment (#138)

* Remove (#92)

Co-authored-by: Pjaijai <[email protected]>

* [#137] Config email testing on local environment

* Fix .env variable name

---------

Co-authored-by: Pjaijai <[email protected]>
Co-authored-by: Pjaijai <[email protected]>

* Feature/cc sender when sending email (#140)

* Add sender email to cc

* Updating reminder text in contact dialog

---------

Co-authored-by: Pjaijai <[email protected]>

* Feature/adding type from supabase (#124)

* Adding supabase type

* Adding workflow files

* fix types

---------

Co-authored-by: Pjaijai <[email protected]>

* Feature/Adding initial data (#125)

* Adding initial data

* Update

* update st johns value

* Update

* Fix typo

---------

Co-authored-by: Pjaijai <[email protected]>

* Feature/revamp card (#135)

* Feature/update backend setup on developer md (#104)

* Ignore local IDE config

* Update backend setup guidelines on developer.md

* Add supabase config guidelines

* Fix md syntax

* add CORS to edge func depending on the staging env

* add reply-to header to both contact email (#109)

* Feature/refactor search hook (#96)

* Refactor search hook in referral page

* Refactor referee search hook

* Remove useless import

* Refactor referee post

* Refactor referrer post search hook

* Remmove uesless import

* Change to error toast (#106)

Co-authored-by: Pjaijai <[email protected]>

---------

Co-authored-by: Pjaijai <[email protected]>

* create new card component for referrer and referee; update card skeleton; add missing modules in tailwind

* add referral post card; update referral post pages

* update contact toUuid; minor ui fix

* add items-center to info display

* Show edit button on profile page if logged-in user is profile user

* Fix build error

* Fix typos

* Import as module path

* Module import

* Using Link instead of onurlclick

* Fix import

* Remove id slug user page

* Remove showEditButton props

---------

Co-authored-by: Lulu <[email protected]>
Co-authored-by: Thomas Yau <[email protected]>
Co-authored-by: Thomas Yau <[email protected]>
Co-authored-by: Pjaijai <[email protected]>
Co-authored-by: Pjaijai <[email protected]>
Co-authored-by: Lulu Tung <[email protected]>

* Refactor/fix all formart problem (#142)

* Fix doc

* Fix format

---------

Co-authored-by: Pjaijai <[email protected]>

* Hotfix/fix post duplication (#144)

* Fix IUserResponse type

* Fix api

* Fix type

* Fix api

* House keep

* Fetch 3 per page in search referral api

* Fix search post api

* House keep

* fix type

* fix format

* Fix number of order per page

---------

Co-authored-by: Pjaijai <[email protected]>

* Feature/adding tailwind plugin (#145)

* Adding prettier-plugin-tailwindcss and prettier

* Fixing formart

---------

Co-authored-by: Pjaijai <[email protected]>

* Bugfix/Card UI (#160)

* fix card ui bugs; modify the contact button of referral post card in mobile

* chaneg relative paths to absolute

* Bugfix/fix contact dialog text (#156)

* Fix text

* fix text

---------

Co-authored-by: Pjaijai <[email protected]>

* Fix UI (#163)

Co-authored-by: Pjaijai <[email protected]>

* Add word break (#162)

Co-authored-by: Pjaijai <[email protected]>

* Doc/adding local db dev guidelines (#146)

* Updating docs for backend local dev

* Fix typo

* House keep

* fix typo

---------

Co-authored-by: Pjaijai <[email protected]>

* version bump to 1.4.0 (#167)

Co-authored-by: Pjaijai <[email protected]>

---------

Co-authored-by: Pjaijai <[email protected]>
Co-authored-by: Lulu <[email protected]>
Co-authored-by: marukosy124 <[email protected]>
Co-authored-by: Thomas Yau <[email protected]>
Co-authored-by: Thomas Yau <[email protected]>
Co-authored-by: Lulu Tung <[email protected]>
  • Loading branch information
7 people authored Oct 23, 2023
1 parent 71bf253 commit 6d95ddc
Show file tree
Hide file tree
Showing 82 changed files with 1,719 additions and 500 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/production-update-types.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# https://supabase.com/docs/guides/api/rest/generating-types

name: Update production database types
on:
push:
branches: [main]
paths:
- "*.sql"

jobs:
build:
runs-on: ubuntu-latest
if: github.head_ref != 'supabot**'
steps:
- uses: lyqht/generate-supabase-db-types-github-action@main
with:
SUPABASE_REF_ID: ${{ secrets.PRODUCTION_PROJECT_ID }}
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
DB_PASSWORD: ${{ secrets.PRODUCTION_DB_PASSWORD }}
OUTPUT_PATH: db.types.ts
20 changes: 20 additions & 0 deletions .github/workflows/staging-update-types.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# https://supabase.com/docs/guides/api/rest/generating-types

name: Update staging database types
on:
push:
branches: [development]
paths:
- "*.sql"

jobs:
build:
runs-on: ubuntu-latest
if: github.head_ref != 'supabot**'
steps:
- uses: lyqht/generate-supabase-db-types-github-action@main
with:
SUPABASE_REF_ID: ${{ secrets.STAGING_PROJECT_ID }}
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
DB_PASSWORD: ${{ secrets.STAGING_DB_PASSWORD }}
OUTPUT_PATH: db.types.ts
53 changes: 37 additions & 16 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
## Introduction
## 1. Introduction

Hello and welcome! We are delighted to have you join our community! 🎉🌟

## Tech Stack
## 2.Tech Stack

Frontend : Next.js 13, Zustand, React-Hook-Form, Tanstack Query, Shadcn(Radix + Tailwind.css)
Backend: Supabase , SQL
Infra : Vercel, Supabase
Email service: Resend
Analytic : GA, Vercel Analytic
Analytic : GA, Vercel Analytic

## Current Table Structure
## 3.Current Table Structure

Check [here](https://dbdiagram.io/d/Referalah-651b7b71ffbf5169f0e71a7a)

## To solve user data cannot be inserted after registration
## 4.To solve user data cannot be inserted after registration

I'm uncertain about the reason why, but there should be a trigger that inserts user data into the user table after registration. I did execute the migration, but unfortunately, it did not generate the trigger as expected. To address this issue, please run the following SQL command in your local SQL editor:

Expand Down Expand Up @@ -51,24 +51,43 @@ create or replace trigger on_auth_user_created
for each row execute procedure public.handle_new_user();
```

### Frontend
### 5.Frontend

1. Open your terminal.
2. Navigate to the 'client' directory using the `cd client` command.
3. Run the development server using `yarn dev`.
4. Clone .env.template and rename it to `.env`
5. Find Supabase URL and anon key from Project Setting > API and configure `.env`
4. Clone `.env.template` and rename it to `.env`.
5. Find Supabase URL and anon key from Project Setting > API and configure `.env`.

### Backend
### 6.Backend (local)

1. Install [Supabase CLI](https://supabase.com/docs/guides/cli/getting-started#updating-the-supabase-cli)
2. Run `supabase start`
3. Create a [new Supabase project](https://supabase.com/dashboard/projects)
4. Navigate to the project, go to `Project Setting`. Go to `General`. Copy `Reference ID`
5. Run `supabase link --project-ref [your-supabase-project-id]`
6. Run `supabase db push` to run migrations on your supabase project
7. Import [csv files](https://drive.google.com/drive/folders/14Q5xqmHU9w1v7Zv9HlxL3qr--Cw_4z7b?usp=drive_link) into your Supabase project for `city`, `country`, `industry` and `province` tables
8. Connect Supabase database to your favourite database IDE. Run [SQL Script](#to-solve-user-data-cannot-be-inserted-after-registration) to insert user data upon registration
2. Navigate to the 'supabase' directory using the `cd supabase` command.
3. Run `supabase start`
4. Connect Supabase database to your favourite database IDE/or using supabase local[http://localhost:54323/project/default]. Run [SQL Script](#to-solve-user-data-cannot-be-inserted-after-registration) to insert user data upon registration.
5. Create a [Resend](https://resend.com) account for email sending. Link it to your Supabase project and get an API key.
6. configure your `.env.local`, add your `RESEND_API_KEY` from Resend and use your Resend email account as `RESEND_TO_EMAIL`.
7. To start local edge function, create a `.env.local` at the root of supabase folder. Run command `supabase functions serve --env-file ./supabase/.env.local`.

### 7.Backend Migration

For accurate information, please check supabase local dev doc here[https://supabase.com/docs/guides/cli/local-development]

# Method A (Github Actions)

1. Create two[new Supabase project](https://supabase.com/dashboard/projects). One for staging and one for production.
2. Go Github > repo > setting > secrets and variables > Actions > adding required variables (Check `production.yml` and `staging.yml`).
3. When you push and changes, github actions should run to migrate files and deploy edge function automatically.
4. Create a bucket called `user_assets` in `Storage`. It seems like cannot be done through migration ? Need to do manually.

# Method B (Commands)

1. Create a [new Supabase project](https://supabase.com/dashboard/projects).
2. Run `supabase login` with your `personal access token` from supabase.
3. Run `supabase link --project-ref [your-supabase-project-id]`.
4. Run `supabase db push` to run migrations on your supabase project.
5. Clone `.env.template` from `supabase/` and rename it to `.env.local`.
6. Every time you make changes to Supabase functions, run `supabase functions deploy --project-ref [your-supabase-project-id]`.

### Creating branch

Expand All @@ -80,6 +99,7 @@ Naming your branch with category. For example `feature/i-go-to-school-by-bus`. P
| bugfix | for fixing a bug |
| feature | for adding, removing or modifying a feature |
| doc | document |
| refactor | refactoring |

### Creating Pull Request

Expand All @@ -91,5 +111,6 @@ Naming your PR with category. For example `Feature/I Go To School By Bus`
| BugFix | for fixing a bug |
| Feature | for adding, removing or modifying a feature |
| Doc | document |
| refactor | refactoring |

Now you have both the frontend and backend of Referalah up and running locally, allowing you to work on and test your changes effectively. Happy coding!
25 changes: 13 additions & 12 deletions client/app/about/page.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
"use client"

import React from "react"

import { Separator } from "@/components/ui/separator"

const AboutPage = () => {
return (
<div className="container mt-12 p-0">
<section>
<h2 className="text-center text-4xl sm:text-6xl font-bold">理念</h2>
<h3 className="mt-12 text-base container">
<h2 className="text-center text-4xl font-bold sm:text-6xl">理念</h2>
<h3 className="container mt-12 text-base">
海外搵工好多時都需要人脈,有人推薦先有面試,而外地愈嚟愈多港人,但缺乏相關文化同平台。呢個平台喺俾大家搵翻同聲同氣嘅,無論你係藍領白領,都希望大家互相幫忙。
</h3>
</section>
<Separator className="mt-12" />
<section className="container grid items-center gap-6 pb-8 pt-6 md:py-10">
<h2 className="text-center text-4xl sm:text-6xl font-bold">
<h2 className="text-center text-4xl font-bold sm:text-6xl">
如何運作?
</h2>
<div className="flex flex-col md:flex-row justify-around w-full">
<div className="flex flex-col text-center font-medium text-lg gap-4">
<h3 className="text-xl md:text-3xl font-semibold">
<div className="flex w-full flex-col justify-around md:flex-row">
<div className="flex flex-col gap-4 text-center text-lg font-medium">
<h3 className="text-xl font-semibold md:text-3xl">
1.加入人脈網絡
</h3>
<h6>去個人檔案剔翻成為推薦人/受薦人。</h6>
Expand All @@ -28,9 +29,9 @@ const AboutPage = () => {
<h6>你哋私底下聯絡,睇吓有冇得搞。</h6>
<h6>祝一切順利!!</h6>
</div>
<Separator className="block md:hidden mt-12" />
<div className="flex flex-col text-center font-medium text-lg gap-4 mt-12 md:mt-0">
<h3 className="text-xl md:text-3xl font-semibold">2.貼街招</h3>
<Separator className="mt-12 block md:hidden" />
<div className="mt-12 flex flex-col gap-4 text-center text-lg font-medium md:mt-0">
<h3 className="text-xl font-semibold md:text-3xl">2.貼街招</h3>
<h6>工作招聘網站見到合適工作/自己公司請人,想推薦香港人入。</h6>
<h6>將相關連結放上嚟。</h6>
<h6>睇吓有冇有緣人,如果有佢可以立即聯絡。</h6>
Expand All @@ -40,11 +41,11 @@ const AboutPage = () => {
</div>
</div>
</section>
<h2 className="text-center text-sm font-bold mt-8">
<h2 className="mt-8 text-center text-sm font-bold">
過程唔會收錢,希望呢個平台幫到大家!
</h2>
<h2 className="text-center text-sm font-bold mt-8">
Btw 聯絡me : [email protected]
<h2 className="mt-8 text-center text-sm font-bold">
Btw 聯絡me : [email protected]
</h2>
</div>
)
Expand Down
2 changes: 1 addition & 1 deletion client/app/auth/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import AuthPageTemplate from "@/modules/auth/template"

const AuthPage = () => {
return (
<div className="mt-20 flex justify-center items-center">
<div className="mt-20 flex items-center justify-center">
<AuthPageTemplate />
</div>
)
Expand Down
42 changes: 21 additions & 21 deletions client/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import "@/styles/globals.css"
import { Metadata } from "next"
import { cookies } from "next/headers"
import { supabase as supabaseClient } from "@/utils/services/supabase/config"
import { createServerComponentClient } from "@supabase/auth-helpers-nextjs"
import { Analytics } from "@vercel/analytics/react"

import { siteConfig } from "@/config/site"
import { fontSans } from "@/lib/fonts"
import { cn } from "@/lib/utils"
import NavFooter from "@/components/customized-ui/footer/nav"
import GoogleAnalytics from "@/components/google-analytics"
import APIProvider from "@/components/providers/api"
import AuthProvider from "@/components/providers/auth"
import ToastProvider from "@/components/providers/toast"
import { SiteHeader } from "@/components/site-header"
import { TailwindIndicator } from "@/components/tailwind-indicator"
import { ThemeProvider } from "@/components/theme-provider"
import { siteConfig } from "@/config/site"
import { Analytics } from '@vercel/analytics/react';
import { fontSans } from "@/lib/fonts"
import { cn } from "@/lib/utils"
import GoogleAnalytics from "@/components/google-analytics"
import ToastProvider from "@/components/providers/toast"
import { supabase as supabaseClient} from "@/utils/services/supabase/config"
import { createServerComponentClient } from '@supabase/auth-helpers-nextjs';
import { cookies } from 'next/headers';

export const metadata: Metadata = {
title: {
Expand All @@ -38,17 +39,16 @@ interface RootLayoutProps {
}

// do not cache this layout
export const revalidate = 0;

export const revalidate = 0

export default async function RootLayout({ children }: RootLayoutProps) {
const supabase = createServerComponentClient({ cookies });
const supabase = createServerComponentClient({ cookies })

const {
data: { session },
} = await supabase.auth.getSession();
} = await supabase.auth.getSession()

const accessToken = session?.access_token || null;
const accessToken = session?.access_token || null

return (
<>
Expand All @@ -65,13 +65,13 @@ export default async function RootLayout({ children }: RootLayoutProps) {
<APIProvider>
<AuthProvider accessToken={accessToken}>
<ToastProvider>
<div className="flex min-h-screen flex-col">
<SiteHeader />
<div className="container flex-grow">{children}</div>
<NavFooter />
</div>
<Analytics />
<TailwindIndicator />
<div className="flex min-h-screen flex-col">
<SiteHeader />
<div className="container flex-grow">{children}</div>
<NavFooter />
</div>
<Analytics />
<TailwindIndicator />
</ToastProvider>
</AuthProvider>
</APIProvider>
Expand Down
66 changes: 37 additions & 29 deletions client/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,62 +1,70 @@
"use client"

import Link from "next/link"
import { BaseNavigationMenu } from "@/components/customized-ui/navigation-menu/base"
import { buttonVariants } from "@/components/ui/button"
import useUserStore from "@/hooks/state/user/store"
import { Icons } from "@/components/icons"

import { siteConfig } from "@/config/site"
import { cn } from "@/lib/utils"
import useGetUserCount from "@/hooks/api/user/get-user-count"
import { siteConfig } from "@/config/site"
import useUserStore from "@/hooks/state/user/store"
import { buttonVariants } from "@/components/ui/button"
import { BaseNavigationMenu } from "@/components/customized-ui/navigation-menu/base"
import { Icons } from "@/components/icons"

export default function IndexPage() {

const isUserSignIn = useUserStore(state=> state.isSignIn)
const {data}= useGetUserCount()
const isUserSignIn = useUserStore((state) => state.isSignIn)
const { data } = useGetUserCount()
return (
<>
<div>

</div>
<div className="flex md:hidden justify-center mt-4">
<div></div>
<div className="mt-4 flex justify-center md:hidden">
<BaseNavigationMenu />
</div>
<section className="container grid items-center gap-6 pb-8 pt-6 md:py-10">
<div className="flex flex-col justify-center">
<h1 className="text-3xl md:text-4xl">
海外港人搵工搵Referral。
</h1>
<h1 className="text-3xl md:text-4xl">海外港人搵工搵Referral。</h1>
<p className="max-w-[700px] text-lg text-muted-foreground">
希望呢個平台幫到大家!祝大家一切順利!
</p>
</div>
<div className={`${isUserSignIn ? 'flex gap-4' : 'flex flex-wrap gap-4'}`}>
<div className={"flex flex-wrap gap-4"}>
<Link
href={siteConfig.page.about.href}
className={buttonVariants({ variant: isUserSignIn ? 'default' :'outline' })}
className={buttonVariants({
variant: isUserSignIn ? "default" : "outline",
})}
>
了解更多
</Link>

<Link
href={siteConfig.links.instagram}
className={cn(buttonVariants({ variant: isUserSignIn ? 'default' :'outline' }), 'gap-2')}

className={cn(
buttonVariants({ variant: isUserSignIn ? "default" : "outline" }),
"gap-2"
)}
>
<Icons.instagram/>
<Icons.instagram />
Instagram
</Link>
{
!isUserSignIn && <Link href={siteConfig.page.auth.href} className={buttonVariants({variant:'default'})}>
登入/註冊
</Link>
}
<h2 className="text-end text-sm mt-4 border-b-2 border-green-700 dark:border-yellow-300"><span className="text-green-700
] dark:text-yellow-300 font-bold">{data || '0'}</span>個會員</h2>
{!isUserSignIn && (
<Link
href={siteConfig.page.auth.href}
className={buttonVariants({ variant: "default" })}
>
登入/註冊
</Link>
)}
<h2 className="mt-4 border-b-2 border-green-700 text-end text-sm dark:border-yellow-300">
<span
className="]
font-bold text-green-700 dark:text-yellow-300"
>
{data || "0"}
</span>
個會員
</h2>
</div>

</section>

</>
)
}
3 changes: 2 additions & 1 deletion client/app/post/referee/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from "react"
import SearchPageLayout from "@/components/layouts/search-page"
import RefereePostPageTemplate from "@/modules/post/referee/template"

import SearchPageLayout from "@/components/layouts/search-page"

const RefereePostPage = () => {
return (
<SearchPageLayout title="人搵工">
Expand Down
Loading

0 comments on commit 6d95ddc

Please sign in to comment.