-
Notifications
You must be signed in to change notification settings - Fork 32
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
feat: skill refactor #152
base: test
Are you sure you want to change the base?
feat: skill refactor #152
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,11 +15,12 @@ | |
*/ | ||
|
||
'use client'; | ||
import { useSelector } from 'react-redux'; | ||
|
||
import { ReactSelect } from '@/components/Select/ReactSelect'; | ||
|
||
import { useAllSkills } from '#/state/application/hooks'; | ||
// import { useRouter, useSearchParams } from 'next/navigation' | ||
import SelectSkills from '#/shared/components/SelectSkills'; | ||
import { useAppDispatch } from '#/state/hooks'; | ||
import { setRequiredSkills, setExperience, setSortBy } from '#/state/shilling/reducer'; | ||
|
||
|
@@ -70,24 +71,13 @@ const SORT_BYS = [ | |
|
||
export function ShillingFilters() { | ||
const dispatch = useAppDispatch(); | ||
|
||
const skillOpts = useAllSkills(); | ||
const selectedSkills = useSelector(state => state.shilling.requiredSkills); | ||
|
||
return ( | ||
<div className="flex"> | ||
<div className="mr-6 w-[568px]"> | ||
<h5 className="mb-2 text-sm">Required Skills:</h5> | ||
<ReactSelect | ||
isMulti | ||
name="skills" | ||
options={skillOpts} | ||
onChange={e => { | ||
const _skills = e.map(i => i.value); | ||
dispatch(setRequiredSkills(_skills)); | ||
}} | ||
className="react-select-noborder !h-12 border-0 " | ||
limit={3} | ||
/> | ||
<SelectSkills selectedSkills={selectedSkills} limit={3} onChange={_skills => dispatch(setRequiredSkills(_skills))} className="react-select-noborder !h-12 border-0 "/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 不需要传 |
||
</div> | ||
<div className="mr-6 w-[240px]"> | ||
<h5 className="mb-2 text-sm">Experience:</h5> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,18 +26,18 @@ import Avatar from '@/components/Avatar'; | |
import { Button } from '@/components/Button'; | ||
import { RepositioningIcon, TriangleIcon, InformationIcon } from '@/components/Icons'; | ||
import { Modal } from '@/components/Modal'; | ||
import { ReactSelect } from '@/components/Select/ReactSelect'; | ||
|
||
import { baseInputStyles } from '#/domain/profile/widgets/blocks'; | ||
import { countries } from '#/lib/countries'; | ||
import { applyGetContact } from '#/services/shilling'; | ||
import { useDetailsPermission } from '#/services/shilling/hooks'; | ||
import { useAllSkills } from '#/state/application/hooks'; | ||
import SelectSkills from '#/shared/components/SelectSkills'; | ||
|
||
import { ContactModal } from '../ContactModal'; | ||
import { HireConfirmModal } from '../HireConfirmModal'; | ||
import { HireOnChainModal } from '../HireOnChainModal'; | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这行多余 |
||
export function Author({ data }) { | ||
const { status } = useSession(); | ||
const router = useRouter(); | ||
|
@@ -52,7 +52,6 @@ export function Author({ data }) { | |
const [applyLoading, setApplyLoading] = useState(false); | ||
const [openToken, setOpenToken] = useState(false); | ||
const [token, setToken] = useState(''); | ||
const skills = useAllSkills(); | ||
const [selectSkills, setSelectSkills] = useState(); | ||
const getContact = token => { | ||
setOpenToken(false); | ||
|
@@ -139,15 +138,7 @@ export function Author({ data }) { | |
<div> | ||
<div> | ||
<p className="mb-1 text-sm opacity-60">Choose the Skill you interested</p> | ||
<ReactSelect | ||
isMulti | ||
options={skills} | ||
onChange={e => { | ||
const _skills = e.map(i => i.value); | ||
setSelectSkills(_skills); | ||
}} | ||
className="react-select-container !min-h-12 border-0" | ||
/> | ||
<SelectSkills selectedSkills={selectSkills} onChange={setSelectSkills} className="react-select-container !min-h-12 border-0"/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 逻辑保持原样,不需要传 |
||
</div> | ||
<div className="mt-4"> | ||
<p className="mb-1 text-sm opacity-60">The developer need you provide your introduction & demand</p> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,23 +15,21 @@ | |
*/ | ||
|
||
'use client'; | ||
import clsx from 'clsx'; | ||
import { useEffect, useState } from 'react'; | ||
|
||
import { OViewer } from '@/components/MarkDown'; | ||
import { Skeleton } from '@/components/Skeleton/details'; | ||
import { fromNow } from '@/utils/date'; | ||
|
||
import SkillInsight from '#/domain/skill/widgets/skill-insight'; | ||
import SkillOverviewView from '#/domain/skill/views/skill-overview'; | ||
import SkillLabel from '#/domain/skill/widgets/skill-label'; | ||
import { ownedNFTs } from '#/services/common'; | ||
import { useDetails } from '#/services/shilling/hooks'; | ||
import { useAllSkills } from '#/state/application/hooks'; | ||
|
||
import { Author } from './Author'; | ||
import { Header } from './Header'; | ||
|
||
export default function Page({ params }) { | ||
const skills = useAllSkills(); | ||
const { data, loading } = useDetails(params.id); | ||
const [nfts, setNfts] = useState([]); | ||
|
||
|
@@ -45,8 +43,6 @@ | |
} | ||
}, [data]); | ||
|
||
console.log(nfts); | ||
|
||
return loading ? ( | ||
<Skeleton /> | ||
) : ( | ||
|
@@ -85,89 +81,10 @@ | |
{data?.rec && <OViewer value={data?.rec} />} | ||
</div> | ||
{/* <BountiesDetail data={data?.detail} /> */} | ||
<div className="mb-14"> | ||
{data?.skill_datas.map(i => ( | ||
<span | ||
key={`skill-tag-${i.id}`} | ||
className="mr-[6px] inline-block mb-2 h-7 rounded-md border border-gray-600 px-2 text-sm leading-7 text-gray-100" | ||
> | ||
{skills?.find(f => f.value === Number(i.skill))?.label} | ||
</span> | ||
))} | ||
</div> | ||
<SkillLabel userId={params.id}/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 单独弄个这个没多大意义,还增加了请求数量,先恢复原样并删除新增的与 |
||
<hr className="my-14 border-gray-400" /> | ||
<div> | ||
<h6 className="mb-6 text-lg">Skills</h6> | ||
<div className="grid grid-cols-3 gap-4"> | ||
{data?.skill_datas.map(i => ( | ||
<div key={`skill-${i.id}`} className="rounded-lg border border-gray-400 p-4"> | ||
<div className="flex items-start justify-between"> | ||
<div> | ||
<h6 className="mb-2 text-base">{skills?.find(f => f.value === i.skill)?.label}</h6> | ||
<div className="text-xs"> | ||
{i.level && ( | ||
<span | ||
className={clsx('mr-2 rounded-sm px-1 py-[2px] capitalize', { | ||
'bg-[rgba(58,171,118,0.1)] text-[#3AAB76]': i.level === 'generally', | ||
'bg-[rgba(24,160,251,0.1)] text-[#18A0FB]': i.level === 'well', | ||
'bg-[rgba(216,97,65,0.1)] text-[#D86141]': i.level === 'proficient', | ||
'bg-[rgba(118,82,237,0.1)] text-[#7652ED]': i.level === 'skilled', | ||
})} | ||
> | ||
{i.level} | ||
</span> | ||
)} | ||
|
||
<span className="opacity-80">Usage time {i.time}Y</span> | ||
</div> | ||
</div> | ||
<svg width="20" height="20" viewBox="0 0 440 440"> | ||
<circle | ||
cx="220" | ||
cy="220" | ||
r="170" | ||
strokeWidth="40" | ||
stroke="rgba(16,16,16,0.1)" | ||
fill="none" | ||
/> | ||
<circle | ||
cx="220" | ||
cy="220" | ||
r="170" | ||
strokeWidth="40" | ||
stroke="rgba(16,16,16,0.4)" | ||
fill="none" | ||
transform="matrix(0,-1,1,0,0,440)" | ||
style={{ | ||
strokeDasharray: | ||
i.level === 'generally' | ||
? '267 1069' | ||
: i.level === 'well' | ||
? '534 1069' | ||
: i.level === 'proficient' | ||
? '801 1069' | ||
: '1069 1069', | ||
}} | ||
/> | ||
</svg> | ||
</div> | ||
<div className="mt-3 flex items-center justify-between border-t border-gray-400 pt-3 text-xs"> | ||
<p className="opacity-80">Estimated cost</p> | ||
<p> | ||
<strong> | ||
${Number(i.cost_min).toFixed(2)}-${Number(i.cost_max).toFixed(2)} | ||
</strong>{' '} | ||
/ Hourly | ||
</p> | ||
</div> | ||
</div> | ||
))} | ||
</div> | ||
</div> | ||
<SkillOverviewView userId={params.id} /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
<div className="h-6" /> | ||
{data?.aspecta_show && ( | ||
<SkillInsight data={data?.skill_user.user_extra_skills} /> | ||
)} | ||
{data?.onchain_show && nfts.length > 0 && ( | ||
<div> | ||
<div className="mb-4 mt-14 flex items-center justify-between"> | ||
|
@@ -175,7 +92,7 @@ | |
</div> | ||
<div className="flex flex-wrap"> | ||
{nfts.map((i, k) => ( | ||
<img | ||
Check warning on line 95 in src/app/shilling/[id]/page.js
|
||
width={64} | ||
height={64} | ||
className="mr-4 mb-4 rounded-full" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个
styles
应当传进新组件