Skip to content

Commit

Permalink
Release v1.20.6 (#382)
Browse files Browse the repository at this point in the history
* test: adding created-at and location helper tests (#272)

* test: adding created-at and location helper tests

* chore: rename folder name

---------

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

* Feature/password sign up and sign in (#269)

* feat: create create user with email password api

* feat: create sign up skeleton

* feat: adding error message to form check box

* feat: adding type for form text input

* refactor: refactor auth email and password validation

* feat: create sign in form validation

* feat: create sign in form skeleton

* chore: rename sign up api and hook

* feat: create sign in form skeleton

* feat: adding auth api ui handling

* fix: fix error toast color

* feat: handle username

* feat: duplicate username handling

* feat: create create user with email password api

* feat: create sign up skeleton

* chore: rename sign up api and hook

* feat: create sign in form skeleton

* fix: fix profile usernam validation

* feat: create signInWithMagicLink api and hook

* chore: rename and move sign in and sign up api type

* feat: create ISignInEmailMagicLinkRequest type

* feat: create magic linka and password sign in form

* feat: create magic link and password sign in validation

* feat: create sign in tab

* feat: create sign in template

* feat: adding left component to input label

* fix: fix auth form tabs height

* chore: house keep

* fix: fix style of register link in sign in template

* chore: house keep

* fix: fix username max length validation

* fix: fix validation text

* feat: create EEmaiVerification

* feat: create email verificaiton page

* feat: add email verification to site config

* feat: sign up page house keep

* feat: remove sign up page checkbox validaiton

* feat: fix text and copy

* fix: add forgort password link to sign in page

* fix: fixing minor issue

\

* style: fixing margin

* refactor: performance improvement

---------

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

* Feature/Add contributor (#276)

* feat: add contributor

* test: fix test

* fix: fix contributor area

---------

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

* style: fix style of sign in page (#277)

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

* Feature/sign up confirmation page (#279)

* chore: fix auth tmeplate import path

* chore: centailize auth templates

* feat: remove hover underline base link button

* feat: create sign up confirmation page

* test: fix test

---------

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

* fix: fix test

* fix: fix password min length validation

* chore: house keep

* refactor: remove link in functions deploy in staging yml file

* Revert "refactor: remove link in functions deploy in staging yml file"

This reverts commit 59f083e.

* feat: add debug log to function deploy

* Feature/forget password (#280)

* feat: create forgot password

* fix: add loading for sigin and sing up

* feat: add disabled to input

* feat: add sign in button to site header

* fix: fix site paht in site config

---------

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

* feat: replace text input instead of form text input in reset password form (#281)

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

* Feature/remove old magic link (#282)

* feat: remove old sign in

* fix: replace sign path insead of auth path

---------

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

* feat: remove contributor button (#283)

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

* chore(release): 1.7.0

* chore(release): 1.7.0

* chore(release): 1.8.0

* chore(release): 1.7.1

* docs: release

* feat: yarn lock update

* feat: temp remove function deploy

* fix: fix build error

* feat: add handling (#285)

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

* Feature/data access  (#286)

* feat: migration script

* feat: remove email from api

* fix: fix contact content email failed to send reset problem

---------

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

* feat: migration file

* fix:  update on contact referral query

* ci: update staging ci file

* fix: fix contact through post function

* ci: remove function deplot

* Refactor/house keep (#288)

* chore: house keep

* house keep

* add back register button title

---------

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

* fix: fix import path

* feat: add new password same as old password handling

* fix: fix text

* fix: fix import error

* feat: turn off local supabase analytics

* Feature/Internationalization set up (#287)

* feat: move app files to have locale path

* feat: install next international

* feat: next internaiton config

* feat: next international implementation

* feat: create combined middleware

* chore: remove layout what not in locale

* feat: update typescript version

* docs: adding next internaiton to doc

---------

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

* Feature/handle signed in user in sign page (#289)

* feat: create not found page

* feat: return not found in sign up page if  user already signed in

* chore: replace throw with replace

* fix: new not found page

---------

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

* Feature/access control (#290)

* feat: create sever admin

* feat: migration restrict user table column access

* feat: replace client with sever admin

* chore: house keep

* chore: house keep

* chore: house keep

---------

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

* feat: added backbtn to post referer page (#294)

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

* style: fix back to post button

* Feature/in app chat room UI (#292)

* feat: update lucide-react

* fix: fix icon onclick error

* feat: chat ui

* feat(message unread ui): messsage unread ui

* chore: house keep

* style: more style on room card

* feat: update lucide-react

* fix: fix icon onclick error

* feat: chat ui

* feat(message unread ui): messsage unread ui

* chore: house keep

* style: more style on room card

* test: chat message card test

* test: chat conversation header test

---------

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

* style: fix layout style

* feat: add helen wong to contributor list

* feat: add selina lam to contributor list

* Feature/In app Chat  (#293)

* Feature/in app chat room UI (#292)

* feat: update lucide-react

* fix: fix icon onclick error

* feat: chat ui

* feat(message unread ui): messsage unread ui

* chore: house keep

* style: more style on room card

* feat: update lucide-react

* fix: fix icon onclick error

* feat: chat ui

* feat(message unread ui): messsage unread ui

* chore: house keep

* style: more style on room card

* test: chat message card test

* test: chat conversation header test

---------

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

* Feature/message logic (#296)

* feat: create message api and logic

* feat: remove email for apis

* feat: fix message referral request for edge funciton

* feat: implement message edge function

* feat: remove contact apis

* feat: update supabse types

* feat: basic message api implementation

* feat: enhance base infinite scroll

* fix: fix for input text

* chore: remove useUpdateConversationLastUpdatedAt

* feat: cretae useUpdateConversation api hook

* feat: update api

* feat: update chat

* feat: update package json script

* feat: update supabase type

* feat: migration script

* chore: rename room to conversation

* feat(implement date in message  card): implment date in mesage card

* feat: add before to created message

* feat: messsage infinite scroll

* fix(fix page overflow problem ): fix page overflow problem

* style: fix style

* fix: fix conversation header url

* feat: conversation scroll

* feat: conversatio header routing

* feat: chat page mobile view

* style: in app chat layout

* feat: close footer when in chat page

* feat: chat api hool refech config

* feat: message real time subscribe

* fix: fix post page layout

* feat: conversation update

* feat: loading and no messange and conversation handleing

* feat: update is convertion seen checking condition

* fix: fix conversation api fetch timing

* style: fix conversation and message card style

* fix: fix message real time refech

* fix: fix in app caht back button

* style: chat message list skletion style

* test: chat skeletion test

* feat: check conversation unseen

* chore: house keep

* feat: add chat provider

* style: fix input field style

* feat: update handle_message_create function migration file

---------

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

* fix: fix build error

* docs: update supabase types

* Bugfix/fix chat style (#301)

* fix: fix chat invalidate logic

* style(fix chat style): fix chat style

* fix: fix build failed

---------

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

* fix: fix build error

* style: chat page an scroll bar style

* Feature/schedule notification for unseen conversation (#302)

* Feature/in app chat room UI (#292)

* feat: update lucide-react

* fix: fix icon onclick error

* feat: chat ui

* feat(message unread ui): messsage unread ui

* chore: house keep

* style: more style on room card

* feat: update lucide-react

* fix: fix icon onclick error

* feat: chat ui

* feat(message unread ui): messsage unread ui

* chore: house keep

* style: more style on room card

* test: chat message card test

* test: chat conversation header test

---------

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

* Feature/message logic (#296)

* feat: create message api and logic

* feat: remove email for apis

* feat: fix message referral request for edge funciton

* feat: implement message edge function

* feat: remove contact apis

* feat: update supabse types

* feat: basic message api implementation

* feat: enhance base infinite scroll

* fix: fix for input text

* chore: remove useUpdateConversationLastUpdatedAt

* feat: cretae useUpdateConversation api hook

* feat: update api

* feat: update chat

* feat: update package json script

* feat: update supabase type

* feat: migration script

* chore: rename room to conversation

* feat(implement date in message  card): implment date in mesage card

* feat: add before to created message

* feat: messsage infinite scroll

* fix(fix page overflow problem ): fix page overflow problem

* style: fix style

* fix: fix conversation header url

* feat: conversation scroll

* feat: conversatio header routing

* feat: chat page mobile view

* style: in app chat layout

* feat: close footer when in chat page

* feat: chat api hool refech config

* feat: message real time subscribe

* fix: fix post page layout

* feat: conversation update

* feat: loading and no messange and conversation handleing

* feat: update is convertion seen checking condition

* fix: fix conversation api fetch timing

* style: fix conversation and message card style

* fix: fix message real time refech

* fix: fix in app caht back button

* style: chat message list skletion style

* test: chat skeletion test

* feat: check conversation unseen

* chore: house keep

* feat: add chat provider

* style: fix input field style

* feat: update handle_message_create function migration file

---------

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

* fix: fix build error

* feat: notify unseenconversation function

* style: fix email style

* fix: fix unseen conversation function return

* fix: fix build error

---------

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

---------

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

* feat(fix email sending error and adding log): fix email sending error and adding log

* fix: fix chat email link

* fix: fix conversation exsist case

* fix: fix chat room redirection in email content

* feat: not showing user massage in notificaiton email

* test: temp remove test

* feat: mobile friendly main page ui (#303)

* feat(mobile friendly main page ui): mobile friendly main page ui

* fix: fix copy

---------

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

* style: update char message card ui (#304)

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

* test: fix message card test

* Feature/mobile menu (#305)

* feat: add side menu for mobile

* feat: update message icon for nav menu; update chat nav link on mobile menu

* fix: updated message test typo

* Feature/translation (#306)

* test: fix message card test

* feat: update layout lang point to locale

* feat: update zh-hk and en-ca copies

* feat: implement i18n keys

* feat: hanlde not static data translation

* style: user count magin

* feat: unify created at

* feat: add locale setting button

* feat: page name i18n impletation

* style: make locale selection visible on mobile

* feat: mobile nav i18n

---------

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

* Feature/mobile no message handling (#307)

* fix: not allow white space username in edit profile

* fix: fix profile page title

* fix: fix profile site config name

* feat: no message to conversation left section

* fix: fix change locale sign our problem

* fix: fix change locale no search params problem

* chore: house keep

---------

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

* fix: fix password email invalid text

* Feature/style house keep (#308)

* style: fix style

* fix: fix theme toggle in mobile nav

---------

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

* Feature/replace magic link with one time passcode (#309)

* feat: replace magic link with one time password

* chore: house keep

* chore: house keep

---------

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

* style: fix opt verfication max width

* feat: message display clickable link (#310)

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

* fix: fix copy

* fix: fix message icon in site header not redirect

* chore(release): 1.8.0

* style: email style

* fix: fix email link

* fix: fix copy

* fix: fix copy

* style: profile buttons container style

* feat: implement bottleneck

* fix: fix copies

* fix: fix copy

* chore: house keep

* chore: house keep

* fix(fix en-ca copy): fix en-ca copy

* feat: optimize notify unseen conversation function (#314)

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

* Feature/api-ssg (#312)

* fix: makes server action works

* fix: fix copy

* fix: fix sign up redirect problem

* feat: user count isg

* feat(remove unauthenticated wrapper): remove unauthenticated wrapper

* feat: remove unauth wrapper

* feat: update options hooks

* feat: update search hook

* feat: ssg in post

* feat(profile cache\): profile cache

* feat: referral cache

* feat: updateb search pop over

* feat: remove react-query-next-experimental

* feat(update profile template): update profile templates

* feat: update referral templates

* feat: update post templates

* fix: fix edit post page rendering

* fix: fix rendering

---------

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

* feat: install speed insights

* chore(release): 1.9.0

* feat: fix sign in link in sign up page

* feat: invalidate instead of refech (#317)

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

* Feature/password eye icon (#316)

* style: password input show eye icon when focus or have value

* style: main page layout

---------

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

* chore(release): 1.10.0

* fix: hotfix conversatio  per page

* chore(release): 1.10.1

* Feature/revamp user profile (#320)

* feat: post detail page title

* feat: fix options schema not null colounm

* docs: fix type

* feat: split profile edit page

* feat: add copies

* feat: add icons

* style: edit and view profile page style

---------

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

* chore(release): 1.10.2

* chore(release): 1.10.3

* fix: fixtype

* feat: post prefech cache

* style: fix profile info card ui padding

* feat: combine providers

* Feature/style enhancement (#325)

* style: add space to post created at

* style: remove des i refferral post card

* fix: fix chat outermost scroll

* refactor: house keep

---------

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

* Featurel/make post sharable (#326)

* feat: install react share

* feat: desktop post share link

---------

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

* Feature/make post sharable (#327)

* feat: share drawer

* feat: update copies

---------

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

* chore(release): 1.11.0

* feat: post preview on main page (#329)

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

* chore(release): 1.12.0

* chore(release): 1.12.1

* fix: fix carousel

* chore(release): 1.12.2

* fix: fix toast not showing

* chore(release): 1.12.3

* Feature/support sending pdf (#333)

* feat: add new icons

* feat: add react-dropzone

* feat: install react-dropzone

* fix: fix api hook path

* feat: add file drop ui to send message form

* feat: support sending pdf in app chat

* feat: support pdf in message contact

* feat: api for cleaning document storeage

* feat: add copies

* feat: update engine in client package json

---------

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

* Feature/support sending pdf (#334)

* feat: add file drop ui to send message form

* feat: support sending pdf in app chat

* feat: support pdf in message contact

* feat: add copies

* fix: fix upload document loading spin

---------

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

* fix: fix yoe in referral post card

* fix: remove github in header

* fix: replace reset icon with copy

* fix: fix infinite scroll infinite loading problem

* fix: fix copy

* fix: fix word break

* fix: fix typo

* feat: add fancy background (#335)

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

* fix: fix fancy background showing logic

* Feature/ Create message record (#336)

* feat: record down message

* fix: fix clipboard window error

* fix: fix main page button rendering error

---------

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

* Feature/increase document maximum size (#337)

* feat: allow upload doc to 2 mb

* feat: show document is expired

---------

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

* try seed migration

* Revert "try seed migration"

This reverts commit 16f38db.

* Feature/add new locations (#338)

* fix: fix profile view check box bg color

* feat: support multi location search

* refactor: house keep

---------

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

* fix: fix ui (#339)

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

* chore(release): 1.13.0

* Feature/update notify unseen conversation (#341)

* chore(release): 1.13.0

* feat(cron notify-unseen-conversation support pdf): cron notify-unseen-conversation support pdf

---------

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

* feat: update clean storage api logic

* refactor: house keep

* chore(release): 1.14.0

* refactor: house keep

* fix: remove cache

* fix: add back location cache

* fix: cache options for 60 seconds

* no cache

* fix: profile apis no store

* Feature/revamp search (#348)

* feat: search bar new ui

* feat: mobile search

* chore: define new engine

---------

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

* Feature/revamp search (#349)

* feat: search bar new ui

* feat: mobile search

* chore: define new engine

* fix: fix searcg drawer ui

---------

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

* BugFix/fix search drawer ui (#350)

* feat: search bar new ui

* feat: mobile search

* chore: define new engine

* fix: fix searcg drawer ui

* fix: fix drawer ui

* fix: fix filter reset

---------

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

* Feature: Revamp post search ux (#351)

* feat: replace post referer and referee with post search and view

* feat: post type title

* feat: display post type

* feat: search post type with search params instead of usestate

---------

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

* fix: fix inistial post search type (#352)

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

* caching (#353)

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

* feat: prefrech to edit post

* chore(release): 1.15.0

* try edti post cache 1 second

* remove default cache

* feat: revalidate location options one day

* fix: fix edit post title

* chore(release): 1.16.0

* fix: fix post history card

* fix: fix post nav description

* fix: fix post referee title

* fix: fix typo

* fix: fothix edge function get user null problem

* chore(release): 1.16.2

* chore: house keep

* feat: create message uuid col for history tbale

* Feature/revamp member page (#363)

* feat: add user search page

* feat: update copies

* feat: display referral type in referral card

* chore: house keep

* chore: house keep

* chore: rename user page to member

* feat: hide become member is user sign in

---------

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

* style: referral card avatar

* chore(release): 1.17.0

* fix: remove member type checking in contact referral

* chore(release): 1.17.1

* Feature/list most latest contact request on laning page (#366)

* feat: create list latest contact request function

* feat: display on client

---------

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

* feat: add links to contact request list

* chore: house keep highlighted link

* chore(release): 1.18.0

* style: fix contact request carousel

* style: fix style

* fix: fix main page cache

* style: fix contact request style

* fix: fix view post link in contact request carousel

* style: fix style

* feat: remove message icon in site header

* refactor: house keep useCheckHasConversationUnseen

* style: update main page Carousel

* style: update style

* feat: replace FormTextInput with FormTextArea

* Feature/request count for post and user (#368)

* style: update style

* feat: replace FormTextInput with FormTextArea

* feat: add count

* fix: reset submit state when error in edit post

* feat: update types

---------

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

* chore(release): 1.19.0

* feat: update user table access

* feat: display the count

* fix: fix ContactRequestCount count text

* style: fix coffee icon size

* fix: fix user card count position

* style(fix count style): fix count style on referral card

* chore(release): 1.20.0

* fix: fix request count on post detail page

* fix: remove fancy stuff (#372)

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

* fix: fix list latest contact request post uuid

* chore(release): 1.20.1

* fix: fix message covered my text input form (#374)

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

* chore(release): 1.20.2

* chore: house keep

* fix: fix post title and company limit to 100

* chore(release): 1.20.3

* Feature/add collaboration type to post (#377)

* feat: support collabration type for post type

* refactor: house keep post hostory card

* feat: add post type option scription

---------

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

* Feature/block user to send chat request or crud post (#378)

* feat: add migration script for checking user staus when update post and create post

* feat: block not active user in message api

---------

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

* fix: fix messsage post user banned problem

* chore(release): 1.20.4

* fix: fix view post title tag

* style: fix request count styles

* fix: hot fix post update count

* chore(release): 1.20.5

* style: fis request count style

* fix: force need help post to have link

* fix: not posting need help link in main page

* chore(release): 1.20.6

---------

Co-authored-by: Pjaijai <[email protected]>
Co-authored-by: Johnson Shan <[email protected]>
Co-authored-by: marukosy124 <[email protected]>
  • Loading branch information
4 people authored Jun 3, 2024
1 parent 5c4613a commit 20f09d8
Show file tree
Hide file tree
Showing 14 changed files with 258 additions and 188 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [1.20.6](https://github.com/Pjaijai/Referalah/compare/v1.20.5...v1.20.6) (2024-06-03)


### Bug Fixes

* force need help post to have link ([be7fa9f](https://github.com/Pjaijai/Referalah/commit/be7fa9fa10cb4435d9d1807b7592c646176edac3))
* not posting need help link in main page ([fd35751](https://github.com/Pjaijai/Referalah/commit/fd35751e59e60bdedc2cd79116aa0ac04c484c48))

### [1.20.5](https://github.com/Pjaijai/Referalah/compare/v1.20.4...v1.20.5) (2024-06-01)


Expand Down
7 changes: 1 addition & 6 deletions client/app/[locale]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,7 @@ export default async function IndexPage() {
jobTitle: "",
maxYearOfExperience: 100,
minYearOfExperience: 0,
types: [
EPostType.REFERRER,
EPostType.REFEREE,
EPostType.HIRING,
EPostType.COLLABORATION,
],
types: [EPostType.REFERRER, EPostType.HIRING, EPostType.COLLABORATION],
})

const list = await listLatestContactRequest()
Expand Down
3 changes: 1 addition & 2 deletions client/components/customized-ui/cards/referral-post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import BaseAvatar from "@/components/customized-ui/avatars/base"
import ContactRequestCount from "@/components/customized-ui/icons/contact-request-count"
import CompanyNameDisplay from "@/components/customized-ui/info-display/company"
import CreatedAtDisplay from "@/components/customized-ui/info-display/created-at"
import { Icons } from "@/components/icons"

interface IReferralPostCardProps {
uuid: string | null
Expand Down Expand Up @@ -110,8 +109,8 @@ const ReferralPostCard: React.FunctionComponent<IReferralPostCardProps> = ({
country={country}
industry={industry}
yearOfExperience={yearOfExperience}
requestCount={requestCount}
/>
{requestCount > 0 && <ContactRequestCount count={requestCount} />}
</div>
<Separator />
</CardHeader>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ const ContactRequestCount: React.FunctionComponent<
return (
<div
className={cn(
"flex shrink-0 flex-row items-center justify-center gap-2 ",
"gap flex shrink-0 flex-row items-center justify-center ",
className
)}
>
<Icons.coffee size={20} />
<Icons.coffee size={18} />

<p>{t("general.chat", { count: count })}</p>
<p className="ml-1">{t("general.chat", { count: count })}</p>
</div>
)
}
Expand Down
30 changes: 30 additions & 0 deletions client/components/customized-ui/info-display/requestion-count.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React, { PropsWithChildren } from "react"
import { useI18n } from "@/utils/services/internationalization/client"

import { cn } from "@/lib/utils"
import { Icons } from "@/components/icons"

interface IRequestCountDisplayProps {
count: number
className?: string
}

const RequestCountDisplay: React.FunctionComponent<
PropsWithChildren<IRequestCountDisplayProps>
> = ({ count, className }) => {
const t = useI18n()
return (
<div className={cn("flex items-center justify-start", className)}>
<div>
<Icons.coffee width="18" height="18" />
</div>
<span className="ml-1">
{t("general.chat", {
count: count ?? 0,
})}
</span>
</div>
)
}

export default RequestCountDisplay
9 changes: 9 additions & 0 deletions client/modules/post/components/info-display/card-info.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { CardDescription } from "@/components/ui/card"
import IndustryDisplay from "@/components/customized-ui/info-display/industry"
import LocationDisplay from "@/components/customized-ui/info-display/location"
import RequestCountDisplay from "@/components/customized-ui/info-display/requestion-count"
import YearsOfExperienceDisplay from "@/components/customized-ui/info-display/years-of-experience"

interface PostCardInfoDisplayProps {
Expand All @@ -9,6 +10,7 @@ interface PostCardInfoDisplayProps {
country: string | null
industry?: string | null
yearOfExperience?: number | null
requestCount: number
}

const PostCardInfoDisplay = ({
Expand All @@ -17,6 +19,7 @@ const PostCardInfoDisplay = ({
country,
industry,
yearOfExperience,
requestCount,
}: PostCardInfoDisplayProps) => {
return (
<CardDescription className="text-overflow-ellipsis flex basis-full flex-wrap items-center justify-start gap-4 sm:basis-3/4">
Expand All @@ -40,6 +43,12 @@ const PostCardInfoDisplay = ({
className="xs:max-w-full max-w-xs"
/>
)}
{typeof requestCount === "number" && requestCount > 0 && (
<RequestCountDisplay
count={requestCount}
className="xs:max-w-full max-w-xs"
/>
)}
</CardDescription>
)
}
Expand Down
168 changes: 92 additions & 76 deletions client/modules/post/create/template.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,89 +45,104 @@ const CreatePostTemplate: React.FunctionComponent<ICreatePostTemplateProps> = ({
}) => {
const t = useI18n()

const createPostValidationSchema = z.object({
url: z
.string()
.max(20000, {
message: t("validation.text.maximum_length", { count: 20000 }),
})
.url({
message: t("validation.link.not_valid"),
})
.optional()
.or(z.literal("")),
description: z
.string()
.max(3000, {
message: t("validation.text.maximum_length", { count: 3000 }),
})
.min(10, {
message: t("validation.text.minimum_length", { count: 10 }),
}),
type: z.enum(
[
EPostType.REFEREE,
EPostType.REFERRER,
EPostType.HIRING,
EPostType.COLLABORATION,
],
{
required_error: t("validation.field_required"),
}
),

countryUuid: z.string().min(1, {
message: t("validation.field_required"),
}),
provinceUuid: z.string().min(1, {
message: t("validation.field_required"),
}),
cityUuid: z.string().min(1, {
message: t("validation.field_required"),
}),
industryUuid: z.string().min(1, {
message: t("validation.field_required"),
}),
yearOfExperience: z
.string()
.min(1, {
message: t("validation.field_required"),
})
.refine(
(value) => {
if (value) {
const number = parseFloat(value)
if (!isNaN(number) && number >= 0 && number <= 100) {
return true
} else {
return false
}
}

return true
// Check if it's a valid number and falls within the range 1 to 100
},
const createPostValidationSchema = z
.object({
url: z
.string()
.max(20000, {
message: t("validation.text.maximum_length", { count: 20000 }),
})
.url({
message: t("validation.link.not_valid"),
})
.optional()
.or(z.literal("")),
description: z
.string()
.max(3000, {
message: t("validation.text.maximum_length", { count: 3000 }),
})
.min(10, {
message: t("validation.text.minimum_length", { count: 10 }),
}),
type: z.enum(
[
EPostType.REFEREE,
EPostType.REFERRER,
EPostType.HIRING,
EPostType.COLLABORATION,
],
{
message: t("validation.year_of_experience.exceed_range"), // Specify the custom error message here
required_error: t("validation.field_required"),
}
),
companyName: z
.string()
.min(1, {

countryUuid: z.string().min(1, {
message: t("validation.field_required"),
})
.max(100, {
message: t("validation.text.maximum_length", { count: 100 }),
}),
jobTitle: z
.string()
.min(1, {
provinceUuid: z.string().min(1, {
message: t("validation.field_required"),
})
.max(100, {
message: t("validation.text.maximum_length", { count: 100 }),
}),
})
cityUuid: z.string().min(1, {
message: t("validation.field_required"),
}),
industryUuid: z.string().min(1, {
message: t("validation.field_required"),
}),
yearOfExperience: z
.string()
.min(1, {
message: t("validation.field_required"),
})
.refine(
(value) => {
if (value) {
const number = parseFloat(value)
if (!isNaN(number) && number >= 0 && number <= 100) {
return true
} else {
return false
}
}

return true
// Check if it's a valid number and falls within the range 1 to 100
},
{
message: t("validation.year_of_experience.exceed_range"), // Specify the custom error message here
}
),
companyName: z
.string()
.min(1, {
message: t("validation.field_required"),
})
.max(100, {
message: t("validation.text.maximum_length", { count: 100 }),
}),
jobTitle: z
.string()
.min(1, {
message: t("validation.field_required"),
})
.max(100, {
message: t("validation.text.maximum_length", { count: 100 }),
}),
})
.refine(
(data) => {
// Ensure URL is required when type is REFERRER
if (data.type === EPostType.REFEREE) {
return data.url && data.url !== ""
}

return true
},
{
message: t("validation.url.referee.required"),
path: ["url"],
}
)

const form = useForm<z.infer<typeof createPostValidationSchema>>({
resolver: zodResolver(createPostValidationSchema),
Expand All @@ -140,6 +155,7 @@ const CreatePostTemplate: React.FunctionComponent<ICreatePostTemplateProps> = ({
provinceUuid: "",
cityUuid: "",
industryUuid: "",
url: "",
},
})
const { toast } = useToast()
Expand Down
Loading

0 comments on commit 20f09d8

Please sign in to comment.