-
Notifications
You must be signed in to change notification settings - Fork 5
Algebraic Constraints Frontend #110
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
Draft
LiaSolo
wants to merge
6
commits into
web-app-dev
Choose a base branch
from
ac-frontend
base: web-app-dev
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.
Draft
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b42359a
add config-algorithm for ac
LiaSolo d6fda9a
add instance list and histogram
LiaSolo 79a776a
fix some comments
LiaSolo 35d3a31
fix some comments 2
LiaSolo 63d23a3
commit before merge
LiaSolo 6a9c6cb
add description
LiaSolo 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
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
kirill-stupakov marked this conversation as resolved.
Show resolved
Hide resolved
|
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 { Interval } from '@graphql/operations/queries/__generated__/GetMainTaskDeps'; | ||
| import { atom } from 'jotai'; | ||
| import { ACSortBy, OrderBy, Pagination } from 'types/globalTypes'; | ||
|
|
||
| export type ACInstance = { | ||
| id: string; | ||
| attribute1: string; | ||
| attribute2: string; | ||
| intervals: Interval[]; | ||
| outliers: number[]; | ||
| }; | ||
|
|
||
| type ACTaskAtom = { | ||
| taskID: string; | ||
| instanceSelected: ACInstance | null; | ||
| pagination: Pagination; | ||
| sortBy: ACSortBy; | ||
| orderBy: OrderBy; | ||
| }; | ||
|
|
||
| export const ACAtomDefaultValues: ACTaskAtom = { | ||
| // general task data | ||
| taskID: '', | ||
| instanceSelected: null, | ||
| pagination: { | ||
| offset: 0, | ||
| limit: 6, | ||
| }, | ||
| sortBy: ACSortBy.NUMBER_OF_INTERVALS, | ||
| orderBy: OrderBy.ASC, | ||
| }; | ||
|
|
||
| export const ACAtomDefaultValuesWithParams = ( | ||
| taskID: string, | ||
| instanceSelected: ACInstance | null, | ||
| sortBy = ACSortBy.NUMBER_OF_INTERVALS, | ||
| orderBy = OrderBy.ASC, | ||
| offset = 0, | ||
| ) => ({ | ||
| ...ACAtomDefaultValues, | ||
| instanceSelected, | ||
| taskID, | ||
| pagination: { | ||
| offset, | ||
| limit: 6, | ||
| }, | ||
| sortBy, | ||
| orderBy, | ||
| }); | ||
|
|
||
| const ACAtom = atom<ACTaskAtom>(ACAtomDefaultValues); | ||
|
|
||
| export default ACAtom; |
52 changes: 52 additions & 0 deletions
52
web-app/client/src/components/ACInstance/ACInstance.module.scss
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 "styles/common"; | ||
|
|
||
| .containerOuter { | ||
| @include paragraph-small; | ||
| display: flex; | ||
| justify-content: space-between; | ||
| gap: 16px; | ||
| margin-bottom: 16px; | ||
| border: solid 2px $black-50; | ||
| border-radius: 8px; | ||
| box-sizing: border-box; | ||
| padding: 16px; | ||
| max-width: 836px; | ||
| background-color: $white-25; | ||
| cursor: pointer; | ||
| } | ||
|
|
||
| .icons { | ||
| width: 16px; | ||
| height: 16px; | ||
| color: $black-75; | ||
| } | ||
|
|
||
| .containerInner { | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: 8px; | ||
| width: 100%; | ||
| min-width: 0; | ||
| } | ||
|
|
||
| .selected { | ||
| border-color: $primary-0; | ||
| background-color: $secondary-1; | ||
| } | ||
|
|
||
| .attributes { | ||
| display: flex; | ||
| align-items: center; | ||
| gap: 8px; | ||
| } | ||
|
|
||
| .attribute { | ||
| @include paragraph-small; | ||
| border: 2px solid transparent; | ||
| border-radius: 8px; | ||
| padding-left: 8px; | ||
| padding-right: 8px; | ||
| background: $black-10; | ||
| text-align: center; | ||
| color: $black-75; | ||
| } |
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,93 @@ | ||
| import cn from 'classnames'; | ||
| import { useAtom } from 'jotai'; | ||
| import { FC } from 'react'; | ||
| import DivisionIcon from '@assets/icons/division.svg?component'; | ||
| import MinusIcon from '@assets/icons/minus.svg?component'; | ||
| import MultiplicationIcon from '@assets/icons/multiplication.svg?component'; | ||
| import PlusIcon from '@assets/icons/plus.svg?component'; | ||
| import ACAtom, { | ||
| ACAtomDefaultValuesWithParams, | ||
| ACInstance, | ||
| } from '@atoms/ACTaskAtom'; | ||
| import { | ||
| GetMainTaskDeps_taskInfo_TaskInfo_data_result_ACTaskResult_ACs_attributes, | ||
| GetMainTaskDeps_taskInfo_TaskInfo_data_result_ACTaskResult_ACs_intervals, | ||
| GetMainTaskDeps_taskInfo_TaskInfo_data_result_ACTaskResult_ACs_outliers, | ||
| Operation, | ||
| } from '@graphql/operations/queries/__generated__/GetMainTaskDeps'; | ||
| import CollapsableView from '../CollapsableView'; | ||
| import styles from './ACInstance.module.scss'; | ||
|
|
||
| type Props = { | ||
| id: string; | ||
| attributes: GetMainTaskDeps_taskInfo_TaskInfo_data_result_ACTaskResult_ACs_attributes; | ||
| operation: Operation; | ||
| outliers: GetMainTaskDeps_taskInfo_TaskInfo_data_result_ACTaskResult_ACs_outliers; | ||
| intervals: GetMainTaskDeps_taskInfo_TaskInfo_data_result_ACTaskResult_ACs_intervals; | ||
| }; | ||
|
|
||
| export const operationIcons = { | ||
| [Operation.ADDITION]: PlusIcon, | ||
| [Operation.MULTIPLICATION]: MultiplicationIcon, | ||
| [Operation.DIVISION]: DivisionIcon, | ||
| [Operation.SUBTRACTION]: MinusIcon, | ||
| }; | ||
|
|
||
| const ACInstance: FC<Props> = ({ | ||
| id, | ||
| attributes, | ||
| operation, | ||
| outliers, | ||
| intervals, | ||
| }) => { | ||
| const [atom, setAtom] = useAtom(ACAtom); | ||
| const handleSelect = () => { | ||
| const instance: ACInstance = { | ||
| id, | ||
| attribute1: attributes.attribute1, | ||
| attribute2: attributes.attribute2, | ||
| intervals: intervals.intervals, | ||
| outliers: outliers.outliers, | ||
| }; | ||
| setAtom({ ...ACAtomDefaultValuesWithParams(atom.taskID, instance) }); | ||
| }; | ||
|
|
||
| const OperationIcon = operationIcons[operation as Operation]; | ||
|
|
||
| const isSelected = atom.instanceSelected?.id === id; | ||
|
|
||
| return ( | ||
| <div | ||
| className={cn(styles.containerOuter, isSelected && styles.selected)} | ||
| onClick={handleSelect} | ||
| > | ||
| <div className={styles.containerInner}> | ||
| Operation | ||
| <div className={styles.attributes}> | ||
| <div className={styles.attribute}>{attributes.attribute1}</div> | ||
| <OperationIcon className={styles.icons} /> | ||
|
|
||
| <div className={styles.attribute}>{attributes.attribute2}</div> | ||
| </div> | ||
| </div> | ||
| <CollapsableView title={`Intervals (${intervals.amount})`}> | ||
| {intervals.intervals.map((elem) => ( | ||
| <> | ||
| <span | ||
| key={`intervals ${elem[0]} ${elem[1]}`} | ||
| >{`[${elem[0]}, ${elem[1]}]`}</span>{' '} | ||
kirill-stupakov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| </> | ||
| ))} | ||
| </CollapsableView> | ||
| <CollapsableView title={`Outliers (${outliers.amount})`}> | ||
| {outliers.outliers.map((elem) => ( | ||
| <> | ||
| <span key={`Outliers ${elem}`}>{elem}</span>{' '} | ||
| </> | ||
| ))} | ||
| </CollapsableView> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default ACInstance; | ||
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 @@ | ||
| export { default } from './ACInstance'; |
40 changes: 40 additions & 0 deletions
40
...app/client/src/components/AlgorithmFormConfigurator/AlgorithmFormConfigurator.module.scss
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,40 @@ | ||
| @import "styles/common"; | ||
|
|
||
| .description { | ||
| margin-top: 16px; | ||
| } | ||
|
|
||
| .baseFormContainer { | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: 24px; | ||
| margin: auto; | ||
| width: 100%; | ||
| max-width: 466px; | ||
| } | ||
|
|
||
| .expandedFormContainer { | ||
| max-width: 1100px; | ||
| } | ||
|
|
||
| .expandedInputsContainer { | ||
| display: grid; | ||
| grid-template-columns: 1fr 1fr; | ||
| column-gap: 32px; | ||
| row-gap: 24px; | ||
| width: 100%; | ||
|
|
||
| @media (max-width: 960px) { | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: 24px; | ||
| } | ||
| } | ||
|
|
||
| .line { | ||
| grid-column: span 2; | ||
| border: 0; | ||
| border-top: 1px solid $black-25; | ||
| width: 100%; | ||
| padding: 0; | ||
| } |
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
2 changes: 1 addition & 1 deletion
2
web-app/client/src/components/AlgorithmFormConfigurator/FormHeader.tsx
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.