-
Notifications
You must be signed in to change notification settings - Fork 38
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
Refactor/bounty #171
base: test
Are you sure you want to change the base?
Refactor/bounty #171
Conversation
先拉取最新代码处理下冲突 |
# Conflicts: # src/app/bounties/[id]/Activities.js # src/app/bounties/[id]/page.js
@missop is attempting to deploy a commit to the OpenBuild Team on Vercel. A member of the Team first needs to authorize it. |
已经合并成功 |
已经转移到其他文件中留在原文件中的代码,确定不再用了就删掉,而非注释。想日后找历史代码就从提交记录里找。 |
好
在 2025年3月20日星期四,Ourai L. ***@***.***> 写道:
… 已经转移到其他文件中留在原文件中的代码,确定不再用了就删掉,而非注释。想日后找历史代码就从提交记录里找。
—
Reply to this email directly, view it on GitHub
<#171 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AF2NA655457SG2TP5QU2ZRT2VIXXFAVCNFSM6AAAAABZCN6LNSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMZZGAZDSMZRG4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
[image: ourai]*ourai* left a comment (openbuildxyz/openbuild-frontend#171)
<#171 (comment)>
已经转移到其他文件中留在原文件中的代码,确定不再用了就删掉,而非注释。想日后找历史代码就从提交记录里找。
—
Reply to this email directly, view it on GitHub
<#171 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AF2NA655457SG2TP5QU2ZRT2VIXXFAVCNFSM6AAAAABZCN6LNSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMZZGAZDSMZRG4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
src/domain/bounty/views/applied-builder-list/AppliedBuilderList.js
Outdated
Show resolved
Hide resolved
src/domain/bounty/views/applied-builder-list/AppliedBuilderList.js
Outdated
Show resolved
Hide resolved
src/domain/bounty/views/applied-builder-list/AppliedBuilderList.js
Outdated
Show resolved
Hide resolved
src/domain/bounty/views/applied-builder-list/AppliedBuilderList.js
Outdated
Show resolved
Hide resolved
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.
这个文件可以直接移动到 domain/bounty/views/process-list
下,并且在 ProcessList
中使用,revalidatePathAction
作为组件属性传入。
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.
这个为什么推荐要从组件属性传入
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.
因为那是个用到了 Next.js 机制的 server action
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.
这个应该放在 widgets
文件夹下
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.
这个文件没有被多次引用,为何要放在 widgets 下面?
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.
判断是不是个视图(view)的标准,是相应的数据源是否为实体,这里 process list 实际上是个字典或枚举值。不符合视图条件的就放进 widgets。
import { useBountyEnvCheck } from '#/domain/bounty/hooks'; | ||
import { useUser } from '#/state/application/hooks'; | ||
|
||
function ProcessListView({process=[],data={},setAppliedModalOpen,setApplyFinishedModalOpen,setAgreeFinishedModalOpen}) { |
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.
把 ApplyFinishedModal
、AppliedModal
、ApplyFinishedModal
都挪到同级文件夹下,对话框显示状态在这个组件里管理,并且 revalidatePathAction
作为组件属性传入
import { EXPERIENCE_OPTIONS } from '#/lib/user'; | ||
import { denyBuilder } from '#/services/creator'; | ||
import { useConfig, useMediaUrl } from '#/state/application/hooks'; | ||
|
||
function AppliedBuilderListView({data,isLoading,setCurrUser,setConfirmModalOpen,setApproveConfirmIds}) { | ||
function AppliedBuilderListView({data,approve}) { |
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.
原则上来讲,UI 组件的属性不应该有函数,但 React 里没有 Vue 那种事件机制,所以用 on-
开头命名的函数视为事件,所以这个应该叫 onApprove
。
import { BountyABI } from '@/constants/abis/bounty'; | ||
import { BOUNTY_SUPPORTED_CHAIN } from '@/constants/chain'; | ||
import { contracts, payTokens } from '@/constants/contract'; | ||
import { useAllowance, useApprove } from '@/hooks/useERC20'; | ||
import { fetcher } from '@/utils/request'; | ||
import { parseTokenUnits } from '@/utils/web3'; | ||
|
||
import { useBountyEnvCheck } from '#/domain/bounty/hooks'; | ||
import AppliedBuilderListView from '#/domain/bounty/views/applied-builder-list'; |
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.
相对路径
<div className="max-h-[400px] overflow-auto"> | ||
<AppliedBuilderListView | ||
data={data} | ||
isLoading={isLoading} |
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.
没有这个属性了
import { BountyABI } from '@/constants/abis/bounty'; | ||
import { BOUNTY_SUPPORTED_CHAIN } from '@/constants/chain'; | ||
import { contracts, payTokens } from '@/constants/contract'; | ||
import { useAllowance, useApprove } from '@/hooks/useERC20'; | ||
import { fetcher } from '@/utils/request'; | ||
import { parseTokenUnits } from '@/utils/web3'; | ||
|
||
import { useBountyEnvCheck } from '#/domain/bounty/hooks'; |
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.
相对路径
@@ -23,17 +23,12 @@ import { Modal } from '@/components/Modal'; | |||
import { withdraw } from '@/constants/bounty'; | |||
|
|||
import { useBountyEnvCheck } from '#/domain/bounty/hooks'; |
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.
相对路径
@@ -28,9 +28,7 @@ import { parseTokenUnits, signBounty } from '@/utils/web3'; | |||
import { useBountyEnvCheck } from '#/domain/bounty/hooks'; |
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.
相对路径
import { revalidatePathAction } from '#/app/actions'; | ||
import { AgreeFinishedModal } from '#/domain/bounty/widgets/process-list/AgreeFinishedModal'; | ||
import { AppliedModal } from '#/domain/bounty/widgets/process-list/AppliedModal'; | ||
import { ApplyFinishedModal } from '#/domain/bounty/widgets/process-list/ApplyFinishedModal'; | ||
import { useUser } from '#/state/application/hooks'; |
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.
三个对话框相对路径引用
|
||
import { formatTime } from '@/utils/date'; | ||
|
||
import { useBountyEnvCheck } from '#/domain/bounty/hooks'; | ||
import { revalidatePathAction } from '#/app/actions'; |
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.
作为组件属性传入:
domain
不允许引用app
和entry
revalidatePathAction
是 server action
No description provided.