-
Notifications
You must be signed in to change notification settings - Fork 1
V2 UI #49
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
Open
adetoye-dev
wants to merge
25
commits into
main
Choose a base branch
from
v2-ui
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
V2 UI #49
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
caef51a
update sidebar ui
adetoye-dev 900d90c
update icons
adetoye-dev edc0fec
add right sidebar
adetoye-dev cd3ab8c
add activity feed to right sidebar
adetoye-dev ea26991
add treasury data
adetoye-dev 38a4405
Add submit evidence flow
adetoye-dev 1f553f4
add create proposal form
adetoye-dev 24df01f
ui changes
adetoye-dev 5b943e4
ui changes
adetoye-dev 5b78e74
update evidence selector
adetoye-dev 9b63d52
add link to home
adetoye-dev 75c76cb
update activity feed rendering
adetoye-dev c011448
whitelist user address
adetoye-dev ff88d2f
update retained rank rendering
adetoye-dev 6f252a7
update dashboard header
adetoye-dev b18e8ed
update pending tasks
adetoye-dev 88c65d4
add profile cards
adetoye-dev 52b7353
style fixes
adetoye-dev 2b4d7f8
add recent contributions card
adetoye-dev 450839d
update ui
adetoye-dev 5ad0f68
show profile for fellows
adetoye-dev 8adc506
update feed for fellows
adetoye-dev 54a2295
show profile for logged in user
adetoye-dev 4298036
update wish type
adetoye-dev dfe5f0a
update submit evidence form
adetoye-dev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| // Copyright 2019-2025 @polkassembly/fellowship authors & contributors | ||
| // This software may be modified and distributed under the terms | ||
| // of the Apache-2.0 license. See the LICENSE file for details. | ||
|
|
||
| 'use client'; | ||
|
|
||
| import React from 'react'; | ||
| import ActivityFeed from '@/components/Home/ActivityFeed'; | ||
| import ActivitySelectorCard from '@/components/Home/ActivitySelectorCard'; | ||
| import { EActivityFeed, ActivityFeedItem, Network } from '@/global/types'; | ||
|
|
||
| interface Props { | ||
| feedItems: ActivityFeedItem[]; | ||
| feed: EActivityFeed; | ||
| network: Network; | ||
| originUrl: string; | ||
| } | ||
|
|
||
| export default function ActivityClientWrapper({ feedItems, feed, network, originUrl }: Props) { | ||
| return ( | ||
| <div className='flex w-full flex-col gap-y-8'> | ||
| <ActivitySelectorCard value={feed} /> | ||
| <ActivityFeed items={feedItems} /> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| // Copyright 2019-2025 @polkassembly/fellowship authors & contributors | ||
| // This software may be modified and distributed under the terms | ||
| // of the Apache-2.0 license. See the LICENSE file for details. | ||
|
|
||
| import { API_ERROR_CODE } from '@/global/constants/errorCodes'; | ||
| import { ClientError } from '@/global/exceptions'; | ||
| import MESSAGES from '@/global/messages'; | ||
| import { EActivityFeed, Network, ServerComponentProps, ActivityFeedItem } from '@/global/types'; | ||
| import { headers } from 'next/headers'; | ||
| import { Metadata } from 'next'; | ||
| import getOriginUrl from '@/utils/getOriginUrl'; | ||
| import getActivityFeed from '@/app/api/v1/feed/getActivityFeed'; | ||
| import ActivityClientWrapper from './ActivityClientWrapper'; | ||
|
|
||
| type SearchParamProps = { | ||
| feed: string; | ||
| network?: string; | ||
| }; | ||
|
|
||
| export const metadata: Metadata = { | ||
| title: 'Activity Feed', | ||
| description: 'View fellowship activity feed and recent proposals.' | ||
| }; | ||
|
|
||
| export default async function ActivityPage({ searchParams }: Readonly<ServerComponentProps<unknown, SearchParamProps>>) { | ||
| const { feed = EActivityFeed.ALL, network } = searchParams ?? {}; | ||
|
|
||
| // validate feed search param | ||
| if (feed && !Object.values(EActivityFeed).includes(feed as EActivityFeed)) { | ||
| throw new ClientError(MESSAGES.INVALID_SEARCH_PARAMS_ERROR, API_ERROR_CODE.INVALID_SEARCH_PARAMS_ERROR); | ||
| } | ||
|
|
||
| const headersList = headers(); | ||
| const originUrl = getOriginUrl(headersList); | ||
|
|
||
| const feedItems = await getActivityFeed({ | ||
| feedType: feed as EActivityFeed, | ||
| originUrl, | ||
| network: network as Network | ||
| }); | ||
|
|
||
| return ( | ||
| <ActivityClientWrapper | ||
| feedItems={feedItems as ActivityFeedItem[]} | ||
| feed={feed as EActivityFeed} | ||
| network={network as Network} | ||
| originUrl={originUrl} | ||
| /> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| // Copyright 2019-2025 @polkassembly/fellowship authors & contributors | ||
| // This software may be modified and distributed under the terms | ||
| // of the Apache-2.0 license. See the LICENSE file for details. | ||
|
|
||
| 'use client'; | ||
|
|
||
| import CreateProposalForm from '@/components/CreateProposal/CreateProposalForm'; | ||
| import { Button } from '@nextui-org/button'; | ||
| import { useRef, useState } from 'react'; | ||
| import { useUserDetailsContext } from '@/contexts'; | ||
| import LinkWithNetwork from '@/components/Misc/LinkWithNetwork'; | ||
|
|
||
| export default function CreateProposal() { | ||
| const { id } = useUserDetailsContext(); | ||
|
|
||
| const formRef = useRef<HTMLFormElement>(null); | ||
| const [isFormValid, setIsFormValid] = useState(false); | ||
| const [isFormLoading, setIsFormLoading] = useState(false); | ||
|
|
||
| const handleSubmit = () => { | ||
| if (formRef.current) { | ||
| formRef?.current?.requestSubmit(); | ||
| } | ||
| }; | ||
|
|
||
| return ( | ||
| <div className='rounded-2xl border border-primary_border p-6'> | ||
| <h3 className='mb-3 font-semibold'>Create Proposal</h3> | ||
|
|
||
| <div> | ||
| {!id ? ( | ||
| <div className='p-6 text-center'> | ||
| Please{' '} | ||
| <LinkWithNetwork | ||
| href='/login' | ||
| className='text-link' | ||
| > | ||
| login | ||
| </LinkWithNetwork>{' '} | ||
| to create a proposal. | ||
| </div> | ||
| ) : ( | ||
| <div className='flex flex-col gap-6'> | ||
| <CreateProposalForm | ||
| formRef={formRef} | ||
| onSuccess={() => { | ||
| // Optionally redirect or show success message | ||
| }} | ||
| onFormStateChange={(isValid, isLoading) => { | ||
| setIsFormValid(isValid); | ||
| setIsFormLoading(isLoading); | ||
| }} | ||
| /> | ||
|
|
||
| <Button | ||
| color='primary' | ||
| onPress={handleSubmit} | ||
| disabled={!isFormValid || isFormLoading} | ||
| className='flex min-h-[40px] flex-1 text-sm' | ||
| > | ||
| {isFormLoading ? 'Creating...' : 'Create Proposal'} | ||
| </Button> | ||
| </div> | ||
| )} | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| // Copyright 2019-2025 @polkassembly/fellowship authors & contributors | ||
| // This software may be modified and distributed under the terms | ||
| // of the Apache-2.0 license. See the LICENSE file for details. | ||
|
|
||
| 'use client'; | ||
|
|
||
| import SubmitEvidenceForm from '@/components/SubmitEvidence/SubmitEvidenceForm'; | ||
| import { Button } from '@nextui-org/button'; | ||
| import { useRef, useState } from 'react'; | ||
| import { useUserDetailsContext } from '@/contexts'; | ||
| import LinkWithNetwork from '@/components/Misc/LinkWithNetwork'; | ||
|
|
||
| export default function SubmitEvidence() { | ||
| const { id } = useUserDetailsContext(); | ||
|
|
||
| const formRef = useRef<HTMLFormElement>(null); | ||
| const [isFormValid, setIsFormValid] = useState(false); | ||
| const [isFormLoading, setIsFormLoading] = useState(false); | ||
|
|
||
| const handleSubmit = () => { | ||
| if (formRef.current) { | ||
| formRef?.current?.requestSubmit(); | ||
| } | ||
| }; | ||
|
|
||
| return ( | ||
| <div className='rounded-2xl border border-primary_border p-6'> | ||
| <h3 className='mb-3 font-semibold'>Submit Evidence</h3> | ||
|
|
||
| <div> | ||
| {!id ? ( | ||
| <div className='p-6 text-center'> | ||
| Please{' '} | ||
| <LinkWithNetwork | ||
| href='/login' | ||
| className='text-link' | ||
| > | ||
| login | ||
| </LinkWithNetwork>{' '} | ||
| to submit evidence. | ||
| </div> | ||
| ) : ( | ||
| <div className='flex flex-col gap-6'> | ||
| <SubmitEvidenceForm | ||
| formRef={formRef} | ||
| onSuccess={() => { | ||
| // Optionally redirect or show success message | ||
| }} | ||
| onFormStateChange={(isValid, isLoading) => { | ||
| setIsFormValid(isValid); | ||
| setIsFormLoading(isLoading); | ||
| }} | ||
| /> | ||
|
|
||
| <Button | ||
| color='primary' | ||
| onPress={handleSubmit} | ||
| disabled={!isFormValid || isFormLoading} | ||
| className='flex min-h-[40px] flex-1 text-sm' | ||
| > | ||
| {isFormLoading ? 'Submitting...' : 'Submit Evidence'} | ||
| </Button> | ||
| </div> | ||
| )} | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| // Copyright 2019-2025 @polkassembly/fellowship authors & contributors | ||
| // This software may be modified and distributed under the terms | ||
| // of the Apache-2.0 license. See the LICENSE file for details. | ||
|
|
||
| 'use client'; | ||
|
|
||
| import CreateProposalForm from '@/components/CreateProposal/CreateProposalForm'; | ||
| import { Button } from '@nextui-org/button'; | ||
| import { Modal, ModalContent, ModalHeader, ModalBody, ModalFooter } from '@nextui-org/modal'; | ||
| import { useRouter } from 'next/navigation'; | ||
| import React, { useRef, useState } from 'react'; | ||
| import { Divider } from '@nextui-org/divider'; | ||
| import { useUserDetailsContext } from '@/contexts'; | ||
| import LinkWithNetwork from '@/components/Misc/LinkWithNetwork'; | ||
| import { FileText } from 'lucide-react'; | ||
|
|
||
| function CreateProposalModal() { | ||
| const router = useRouter(); | ||
| const { id } = useUserDetailsContext(); | ||
|
|
||
| const formRef = useRef<HTMLFormElement>(null); | ||
| const [isModalOpen, setIsModalOpen] = useState(true); | ||
| const [isFormValid, setIsFormValid] = useState(false); | ||
| const [isFormLoading, setIsFormLoading] = useState(false); | ||
|
|
||
| const handleOnClose = () => { | ||
| router.back(); | ||
| }; | ||
|
|
||
| const handleSubmit = () => { | ||
| if (formRef.current) { | ||
| formRef?.current?.requestSubmit(); | ||
| } | ||
| }; | ||
|
|
||
| return ( | ||
| <Modal | ||
| isOpen={isModalOpen} | ||
| onClose={handleOnClose} | ||
| size='5xl' | ||
| scrollBehavior='inside' | ||
| shouldBlockScroll | ||
| className='bg-cardBg' | ||
| > | ||
| <ModalContent> | ||
| {() => | ||
| id ? ( | ||
| <> | ||
| <ModalHeader className='flex items-center gap-2 text-sm'> | ||
| <FileText className='h-6 w-6 font-semibold' /> | ||
| <h3 className='font-semibold'>Create Proposal</h3> | ||
| </ModalHeader> | ||
| <Divider /> | ||
|
|
||
| <ModalBody className='p-6'> | ||
| <CreateProposalForm | ||
| formRef={formRef} | ||
| onSuccess={() => setIsModalOpen(false)} | ||
| onFormStateChange={(isValid, isLoading) => { | ||
| setIsFormValid(isValid); | ||
| setIsFormLoading(isLoading); | ||
| }} | ||
| /> | ||
| </ModalBody> | ||
|
|
||
| <Divider /> | ||
|
|
||
| <ModalFooter> | ||
| <Button | ||
| color='primary' | ||
| onPress={handleSubmit} | ||
| disabled={!isFormValid || isFormLoading} | ||
| className='flex flex-1 bg-primary_accent text-sm' | ||
| > | ||
| {isFormLoading ? 'Creating...' : 'Create Proposal'} | ||
| </Button> | ||
| </ModalFooter> | ||
| </> | ||
| ) : ( | ||
| <div className='p-6 text-center'> | ||
| Please{' '} | ||
| <LinkWithNetwork | ||
| href='/login' | ||
| className='text-link' | ||
| > | ||
| login | ||
| </LinkWithNetwork>{' '} | ||
| to create a proposal. | ||
| </div> | ||
| ) | ||
| } | ||
| </ModalContent> | ||
| </Modal> | ||
| ); | ||
| } | ||
|
|
||
| export default CreateProposalModal; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Route away when the modal succeeds.
Successful proposal creation leaves the modal route in place but with the dialog hidden, so the user hits a blank screen. Mirror the regular close path by sending the router back after setting the modal closed.
📝 Committable suggestion
🤖 Prompt for AI Agents