-
Notifications
You must be signed in to change notification settings - Fork 2
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
MDE/PKFE-31 #57
Merged
Merged
MDE/PKFE-31 #57
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
6b68a98
MDE/PKFE-31 bug-fix
mantvydasdeltuva be9dc76
MDE/PKFE-31 updated workspace provider for file tree array
mantvydasdeltuva fc8d067
MDE/PKFE-31 toolbar resizing
mantvydasdeltuva c27b552
MDE/PKFE-31 implemented toolbar context provider
mantvydasdeltuva 456a4f7
MDE/PKFE-31 overhauled toolbar buttons logic for hook support
mantvydasdeltuva 26f842d
MDE/PKFE-31 styled core components for param fields
mantvydasdeltuva 36af934
MDE/PKFE-31 implemented different groups params fields
mantvydasdeltuva 523657e
MDE/PKFE-31 updated toolbar view
mantvydasdeltuva 33d500c
MDE/PKFE-31 update button icon color on disabled
mantvydasdeltuva 9a0b879
MDE/PKFE-31 removed commented code
mantvydasdeltuva f758a51
MDE/PKFE-31 select changes during file selection
mantvydasdeltuva 6c8fad4
MDE/PKFE-31 params additional fixes and changes
mantvydasdeltuva ae02827
MDE/PKFE-31 visual bug-fix
mantvydasdeltuva 29974ef
Fixed visual issues
justinnas 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 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 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
106 changes: 85 additions & 21 deletions
106
...-end/src/features/editor/components/toolbarView/toolbarGroupButtons/applyGroupButtons.tsx
This file contains 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 |
---|---|---|
@@ -1,26 +1,90 @@ | ||
import { ToolbarGroupItem, ToolbarGroupItemProps } from '@/features/editor/components/toolbarView'; | ||
import { useToolbarContext } from '@/features/editor/hooks'; | ||
import { useStatusContext } from '@/hooks'; | ||
import { Deblur as DeblurIcon } from '@mui/icons-material'; | ||
import { useCallback, useMemo } from 'react'; | ||
|
||
import { ToolbarGroupItemProps } from '@/features/editor/components/toolbarView'; | ||
export interface ApplyGroupButtonsProps {} | ||
|
||
const applySpliceAiClick = () => { | ||
console.log('Clicked Apply SpliceAI Button!'); | ||
}; | ||
export const ApplyGroupButtons: React.FC<ApplyGroupButtonsProps> = () => { | ||
const { blockedStateUpdate } = useStatusContext(); | ||
const { saveTo, override, applyTo, applyErrorStateUpdate } = useToolbarContext(); | ||
|
||
const applyCaddClick = () => { | ||
console.log('Clicked Apply CADD Button!'); | ||
}; | ||
const applySpliceAiClick = useCallback(async () => { | ||
if (!applyTo) { | ||
applyErrorStateUpdate('Please select a file'); | ||
return; | ||
} | ||
|
||
blockedStateUpdate(true); | ||
|
||
try { | ||
console.log( | ||
'Clicked Apply SpliceAI Button! Params:\n saveTo:', | ||
saveTo, | ||
'\n override:', | ||
override, | ||
'\n applyTo:', | ||
applyTo | ||
); | ||
|
||
await new Promise((resolve) => setTimeout(resolve, 1000)); // TODO: remove this line | ||
} catch (error) { | ||
console.error('Error applying SpliceAI:', error); | ||
} finally { | ||
blockedStateUpdate(false); | ||
} | ||
}, [saveTo, override, applyTo]); | ||
|
||
const applyCaddClick = useCallback(async () => { | ||
if (!applyTo) { | ||
applyErrorStateUpdate('Please select a file'); | ||
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. No need for the long text inside a file selector, could just leave the component red 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. |
||
return; | ||
} | ||
|
||
export const ApplyGroupButtons: ToolbarGroupItemProps[] = [ | ||
{ | ||
group: 'apply', | ||
icon: DeblurIcon, | ||
label: 'Apply SpliceAI', | ||
onClick: applySpliceAiClick, | ||
}, | ||
{ | ||
group: 'apply', | ||
icon: DeblurIcon, | ||
label: 'Apply CADD', | ||
onClick: applyCaddClick, | ||
}, | ||
]; | ||
blockedStateUpdate(true); | ||
|
||
try { | ||
console.log( | ||
'Clicked Merge LOVD & ClinVar Button! Params:\n saveTo:', | ||
saveTo, | ||
'\n override:', | ||
override, | ||
'\n applyTo:', | ||
applyTo | ||
); | ||
|
||
await new Promise((resolve) => setTimeout(resolve, 1000)); // TODO: remove this line | ||
} catch (error) { | ||
console.error('Error applying CADD:', error); | ||
} finally { | ||
blockedStateUpdate(false); | ||
} | ||
}, [saveTo, override, applyTo]); | ||
|
||
const buttons: ToolbarGroupItemProps[] = useMemo( | ||
() => [ | ||
{ | ||
group: 'apply', | ||
icon: DeblurIcon, | ||
label: 'Apply SpliceAI', | ||
onClick: applySpliceAiClick, | ||
}, | ||
{ | ||
group: 'apply', | ||
icon: DeblurIcon, | ||
label: 'Apply CADD', | ||
onClick: applyCaddClick, | ||
}, | ||
], | ||
[applySpliceAiClick, applyCaddClick] | ||
); | ||
|
||
return ( | ||
<> | ||
{buttons.map((button, index) => ( | ||
<ToolbarGroupItem key={index} {...button} /> | ||
))} | ||
</> | ||
); | ||
}; |
133 changes: 102 additions & 31 deletions
133
...d/src/features/editor/components/toolbarView/toolbarGroupButtons/downloadGroupButtons.tsx
This file contains 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 |
---|---|---|
@@ -1,36 +1,107 @@ | ||
import { ToolbarGroupItemProps } from '@/features/editor/components/toolbarView'; | ||
|
||
import { ToolbarGroupItem, ToolbarGroupItemProps } from '@/features/editor/components/toolbarView'; | ||
import { useToolbarContext } from '@/features/editor/hooks'; | ||
import { useStatusContext } from '@/hooks'; | ||
import { Download as DownloadIcon } from '@mui/icons-material'; | ||
import { useCallback, useMemo } from 'react'; | ||
|
||
const handleDownloadLovdClick = () => { | ||
console.log('Clicked Download Lovd Button!'); | ||
}; | ||
export interface DownloadGroupButtonsProps {} | ||
|
||
const handleDownloadClinvarClick = () => { | ||
console.log('Clicked Download Clinvar Button!'); | ||
}; | ||
export const DownloadGroupButtons: React.FC<DownloadGroupButtonsProps> = () => { | ||
const { blockedStateUpdate } = useStatusContext(); | ||
const { saveTo, override, gene } = useToolbarContext(); | ||
|
||
const handleDownloadGnomadClick = () => { | ||
console.log('Clicked Download Gnomad Button!'); | ||
}; | ||
const handleDownloadLovdClick = useCallback(async () => { | ||
blockedStateUpdate(true); | ||
|
||
try { | ||
console.log( | ||
'Clicked Download Lovd Button! Params:\n saveTo:', | ||
saveTo, | ||
'\n override:', | ||
override, | ||
'\n gene:', | ||
gene | ||
); | ||
|
||
await new Promise((resolve) => setTimeout(resolve, 1000)); // TODO: remove this line | ||
} catch (error) { | ||
console.error('Error downloading LOVD file:', error); | ||
} finally { | ||
blockedStateUpdate(false); | ||
} | ||
}, [saveTo, override, gene]); | ||
|
||
const handleDownloadClinvarClick = useCallback(async () => { | ||
blockedStateUpdate(true); | ||
|
||
export const DownloadGroupButtons: ToolbarGroupItemProps[] = [ | ||
{ | ||
group: 'download', | ||
icon: DownloadIcon, | ||
label: 'LOVD', | ||
onClick: handleDownloadLovdClick, | ||
}, | ||
{ | ||
group: 'download', | ||
icon: DownloadIcon, | ||
label: 'ClinVar', | ||
onClick: handleDownloadClinvarClick, | ||
}, | ||
{ | ||
group: 'download', | ||
icon: DownloadIcon, | ||
label: 'gnomAD', | ||
onClick: handleDownloadGnomadClick, | ||
}, | ||
]; | ||
try { | ||
console.log( | ||
'Clicked Download Clinvar Button! Params:\n saveTo:', | ||
saveTo, | ||
'\n override:', | ||
override, | ||
'\n gene:', | ||
gene | ||
); | ||
|
||
await new Promise((resolve) => setTimeout(resolve, 1000)); // TODO: remove this line | ||
} catch (error) { | ||
console.error('Error downloading ClinVar file:', error); | ||
} finally { | ||
blockedStateUpdate(false); | ||
} | ||
}, [saveTo, override, gene]); | ||
|
||
const handleDownloadGnomadClick = useCallback(async () => { | ||
blockedStateUpdate(true); | ||
|
||
try { | ||
console.log( | ||
'Clicked Download Gnomad Button! Params:\n saveTo:', | ||
saveTo, | ||
'\n override:', | ||
override, | ||
'\n gene:', | ||
gene | ||
); | ||
|
||
await new Promise((resolve) => setTimeout(resolve, 1000)); // TODO: remove this line | ||
} catch (error) { | ||
console.error('Error downloading gnomAD file:', error); | ||
} finally { | ||
blockedStateUpdate(false); | ||
} | ||
}, [saveTo, override, gene]); | ||
|
||
const buttons: ToolbarGroupItemProps[] = useMemo( | ||
() => [ | ||
{ | ||
group: 'download', | ||
icon: DownloadIcon, | ||
label: 'LOVD', | ||
onClick: handleDownloadLovdClick, | ||
}, | ||
{ | ||
group: 'download', | ||
icon: DownloadIcon, | ||
label: 'ClinVar', | ||
onClick: handleDownloadClinvarClick, | ||
}, | ||
{ | ||
group: 'download', | ||
icon: DownloadIcon, | ||
label: 'gnomAD', | ||
onClick: handleDownloadGnomadClick, | ||
}, | ||
], | ||
[handleDownloadLovdClick, handleDownloadClinvarClick, handleDownloadGnomadClick] | ||
); | ||
|
||
return ( | ||
<> | ||
{buttons.map((button, index) => ( | ||
<ToolbarGroupItem key={index} {...button} /> | ||
))} | ||
</> | ||
); | ||
}; |
3 changes: 3 additions & 0 deletions
3
app/front-end/src/features/editor/components/toolbarView/toolbarGroupButtons/index.ts
This file contains 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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
export { ApplyGroupButtons } from './applyGroupButtons'; | ||
export type { ApplyGroupButtonsProps } from './applyGroupButtons'; | ||
export { DownloadGroupButtons } from './downloadGroupButtons'; | ||
export type { DownloadGroupButtonsProps } from './downloadGroupButtons'; | ||
export { MergeGroupButtons } from './mergeGroupButtons'; | ||
export type { MergeGroupButtonsProps } from './mergeGroupButtons'; |
Oops, something went wrong.
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.
No need for the long text inside a file selector, could just leave the component red
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.
Fixed with MDE/PKFE-31 select changes during file selection