generated from EasyWebApp/WebCell-scaffold
-
Notifications
You must be signed in to change notification settings - Fork 7
[add] Project Evaluation page with Interactive Chat UI #87
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
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
d6aed50
Initial plan
Copilot 495d672
Fix build issues and prepare for project evaluation page implementation
Copilot e78d115
Complete implementation of project evaluation page with chat interface
Copilot 75e3479
Implement all user feedback - JSX rendering, class component, ScrollL…
Copilot 44cb859
Implement user feedback - remove compatibility layer, move ProjectCar…
Copilot 9ed840a
Address user feedback: Fix translations, EvaluationDisplay component,…
Copilot a16c2e8
Address code review feedback: Update EvaluationDisplay to use semanti…
Copilot a632ece
Request clarification on RequirementEvaluation type structure
Copilot f200531
[fix] some detail bugs of Koa router & Back-end API
TechQuery dd9a343
Fix @idea2app/data-server package integration - update EvaluationDisp…
Copilot 19b1a0b
[fix] several GitHub copilot bugs
TechQuery 20fa8db
Addressing PR comments
Copilot 7a9a6a6
Add new project creation to dashboard and commercial version link to …
Copilot a7971f8
Address PR comments: Remove test file, unified requirement form with …
Copilot ba01d8a
Address PR feedback: Extract VersionComparison component, use proper …
Copilot 9b542f9
[fix] ESLint sorting of TypeScript importing
TechQuery 0c10252
Add chat input interface to project evaluation page
Copilot c7e69d1
Implement advanced message handling with local caching, auto-scroll, …
Copilot 59c3d32
Address PR feedback: Fix models with lodash.debounce, proper scroll t…
Copilot 2ae6715
Fix TypeScript lint issues: sort imports and replace any type with pr…
Copilot 1f63b76
[fix] many GitHub copilot bugs
TechQuery 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| import { RequirementEvaluation, UserRole } from '@idea2app/data-server'; | ||
| import { Box, Typography } from '@mui/material'; | ||
| import { observer } from 'mobx-react'; | ||
| import { FC, useContext } from 'react'; | ||
|
|
||
| import { I18nContext } from '../../models/Translation'; | ||
| import userStore from '../../models/User'; | ||
|
|
||
| export const EvaluationDisplay: FC<RequirementEvaluation> = observer( | ||
| ({ | ||
| title, | ||
| scopes = [], | ||
| developerCount, | ||
| designerCount, | ||
| workload, | ||
| monthPeriod, | ||
| budget, | ||
| factor, | ||
| }) => { | ||
| const { t } = useContext(I18nContext), | ||
| { roles } = userStore.session || {}; | ||
|
|
||
| return ( | ||
| <Box | ||
| sx={{ | ||
| '& .evaluation-item': { | ||
| marginBottom: 1, | ||
| fontSize: '0.875rem', | ||
| padding: '4px 0', | ||
| borderLeft: '3px solid', | ||
| borderColor: 'primary.light', | ||
| paddingLeft: 1, | ||
| }, | ||
| '& ul': { | ||
| margin: '8px 0', | ||
| paddingLeft: '20px', | ||
| }, | ||
| '& li': { | ||
| marginBottom: '4px', | ||
| }, | ||
| }} | ||
| > | ||
| {title && ( | ||
| <Box className="evaluation-item"> | ||
| <Typography component="h3" sx={{ fontWeight: 600, mb: 1 }}> | ||
| {title} | ||
| </Typography> | ||
| </Box> | ||
| )} | ||
| {scopes[0] && ( | ||
| <Box className="evaluation-item"> | ||
| <Typography component="h4" sx={{ fontWeight: 600 }}> | ||
| {t('development_scopes')} | ||
| </Typography> | ||
| <Box component="ul" sx={{ mt: 0.5 }}> | ||
| {scopes.map(scope => ( | ||
| <Box key={scope} component="li" sx={{ ml: 1 }}> | ||
| {scope} | ||
| </Box> | ||
| ))} | ||
| </Box> | ||
| </Box> | ||
| )} | ||
| {workload && ( | ||
| <Box className="evaluation-item"> | ||
| <Typography component="h4" sx={{ fontWeight: 600 }}> | ||
| {t('workload')} | ||
| </Typography>{' '} | ||
| {workload} {t('hours')} | ||
| </Box> | ||
| )} | ||
| {monthPeriod && ( | ||
| <Box className="evaluation-item"> | ||
| <Typography component="h4" sx={{ fontWeight: 600 }}> | ||
| {t('timeline')} | ||
| </Typography>{' '} | ||
| {monthPeriod} {t('months')} | ||
| </Box> | ||
| )} | ||
| {budget && ( | ||
| <Box className="evaluation-item"> | ||
| <Typography component="h4" sx={{ fontWeight: 600 }}> | ||
| {t('budget')} | ||
| </Typography>{' '} | ||
| RMB¥{budget.toLocaleString()} | ||
| </Box> | ||
| )} | ||
| {(developerCount || designerCount) && ( | ||
| <Box className="evaluation-item"> | ||
| <Typography component="h4" sx={{ fontWeight: 600 }}> | ||
| {t('team_size')} | ||
| </Typography>{' '} | ||
| {[ | ||
| developerCount && `${developerCount} ${t('developers')}`, | ||
| designerCount && `${designerCount} ${t('designers')}`, | ||
| ] | ||
| .filter(Boolean) | ||
| .join(', ')} | ||
| </Box> | ||
| )} | ||
| {roles && roles.includes(2 as UserRole.Client) && ( | ||
| <Box className="evaluation-item"> | ||
| <Typography component="h4" sx={{ fontWeight: 600 }}> | ||
| {t('complexity_factor')} | ||
| </Typography>{' '} | ||
| {factor} | ||
| </Box> | ||
| )} | ||
| </Box> | ||
| ); | ||
| }, | ||
| ); |
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,52 @@ | ||
| import { Project } from '@idea2app/data-server'; | ||
| import { Button, Card, CardActions, CardContent, Typography } from '@mui/material'; | ||
| import { observer } from 'mobx-react'; | ||
| import Link from 'next/link'; | ||
| import { FC, useContext } from 'react'; | ||
|
|
||
| import { I18nContext } from '../../models/Translation'; | ||
|
|
||
| export const ProjectCard: FC<Project> = observer(({ id, name, projectStatus }) => { | ||
| const { t } = useContext(I18nContext); | ||
|
|
||
| return ( | ||
| <Card> | ||
| <CardContent> | ||
| <Typography variant="h6" component="h3" gutterBottom> | ||
| {name} | ||
| </Typography> | ||
| <Typography | ||
| variant="caption" | ||
| sx={{ | ||
| px: 1, | ||
| py: 0.5, | ||
| borderRadius: 1, | ||
| bgcolor: | ||
| projectStatus === '1' | ||
| ? 'success.light' | ||
| : projectStatus === '0' | ||
| ? 'grey.200' | ||
| : 'warning.light', | ||
| color: | ||
| projectStatus === '1' | ||
| ? 'success.contrastText' | ||
| : projectStatus === '0' | ||
| ? 'text.primary' | ||
| : 'warning.contrastText', | ||
| }} | ||
| > | ||
| {projectStatus === '1' | ||
| ? t('project_open') | ||
| : projectStatus === '0' | ||
| ? t('project_closed') | ||
| : t('project_pending')} | ||
| </Typography> | ||
| </CardContent> | ||
| <CardActions> | ||
| <Button component={Link} href={`/dashboard/project/${id}`} size="small" variant="contained"> | ||
| {t('view_evaluation')} | ||
| </Button> | ||
| </CardActions> | ||
| </Card> | ||
| ); | ||
| }); |
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
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,47 @@ | ||
| import { Box, Card, CardContent, Grid, Typography } from '@mui/material'; | ||
| import { observer } from 'mobx-react'; | ||
| import { FC, useContext } from 'react'; | ||
|
|
||
| import { I18nContext } from '../models/Translation'; | ||
|
|
||
| export const VersionComparison: FC = observer(() => { | ||
| const { t } = useContext(I18nContext); | ||
|
|
||
| return ( | ||
| <Grid container spacing={4} sx={{ mt: 4 }}> | ||
| <Grid size={{ xs: 12, md: 6 }}> | ||
| <Card sx={{ height: '100%' }}> | ||
| <CardContent> | ||
| <Typography variant="h5" component="h2" gutterBottom> | ||
| {t('public_version')} | ||
| </Typography> | ||
| <Box component="ol" sx={{ pl: 2 }}> | ||
| <Typography component="li">{t('github_one_click_login')}</Typography> | ||
| <Typography component="li">{t('free_evaluation_daily_limit')}</Typography> | ||
| <Typography component="li">{t('submitted_data_public')}</Typography> | ||
| <Typography component="li">{t('volunteer_community_support')}</Typography> | ||
| <Typography component="li">{t('open_source_bounty_development')}</Typography> | ||
| </Box> | ||
| </CardContent> | ||
| </Card> | ||
| </Grid> | ||
|
|
||
| <Grid size={{ xs: 12, md: 6 }}> | ||
| <Card sx={{ height: '100%' }}> | ||
| <CardContent> | ||
| <Typography variant="h5" component="h2" gutterBottom> | ||
| {t('commercial_version')} | ||
| </Typography> | ||
| <Box component="ol" sx={{ pl: 2 }}> | ||
| <Typography component="li">{t('phone_one_click_register')}</Typography> | ||
| <Typography component="li">{t('unlimited_evaluation_24_7')}</Typography> | ||
| <Typography component="li">{t('project_data_confidential')}</Typography> | ||
| <Typography component="li">{t('daily_engineer_review')}</Typography> | ||
| <Typography component="li">{t('professional_development_team')}</Typography> | ||
| </Box> | ||
| </CardContent> | ||
| </Card> | ||
| </Grid> | ||
| </Grid> | ||
| ); | ||
| }); |
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
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,53 @@ | ||
| import { ConsultMessage, Project, ProjectFilter, UserBaseFilter } from '@idea2app/data-server'; | ||
| import debounce from 'lodash.debounce'; | ||
| import { IDType, NewData, toggle } from 'mobx-restful'; | ||
| import { Second } from 'web-utility'; | ||
|
|
||
| import { TableModel } from './Base'; | ||
| import userStore from './User'; | ||
|
|
||
| export type ExtendedProjectFilter = ProjectFilter & UserBaseFilter; | ||
|
|
||
| export class ProjectModel extends TableModel<Project, ExtendedProjectFilter> { | ||
| baseURI = 'project'; | ||
| client = userStore.client; | ||
| } | ||
|
|
||
| export class ConsultMessageModel extends TableModel<ConsultMessage> { | ||
| baseURI = ''; | ||
| client = userStore.client; | ||
|
|
||
| constructor(public projectId: number) { | ||
| super(); | ||
| this.baseURI = `project/${projectId}/consult-message`; | ||
| } | ||
|
|
||
| @toggle('uploading') | ||
| async updateOne({ content }: Partial<NewData<ConsultMessage>>, id?: IDType) { | ||
| const { allItems } = this; | ||
|
|
||
| const newMessage = { | ||
| id: Date.now(), | ||
| content, | ||
| createdAt: new Date().toJSON(), | ||
| createdBy: userStore.session!, | ||
| project: { id: this.projectId }, | ||
| } as ConsultMessage; | ||
|
|
||
| this.restoreList({ allItems: [...allItems, newMessage] }); | ||
|
|
||
| const message = await super.updateOne({ content }); | ||
|
|
||
| this.restoreList({ allItems: [...allItems, message] }); | ||
|
|
||
| this.triggerEvaluation(); | ||
|
|
||
| return message; | ||
| } | ||
|
|
||
| private triggerEvaluation = debounce(async () => { | ||
| const { body } = await this.client.post<ConsultMessage>(`${this.baseURI}/evaluation`); | ||
|
|
||
| this.restoreList({ allItems: [...this.allItems, body!] }); | ||
| }, Second); | ||
| } |
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
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.
Uh oh!
There was an error while loading. Please reload this page.