generated from ensaremirerol/nextjs-fastapi-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dfcd190
commit f3e7cd0
Showing
17 changed files
with
624 additions
and
311 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
29 changes: 0 additions & 29 deletions
29
app/src/pages/ontologies_page/components/AddOntologyDialog/styles.scss
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,29 +0,0 @@ | ||
.card-item { | ||
width: calc(25% - 10px); | ||
max-height: fit-content; | ||
} | ||
|
||
h5 { | ||
text-overflow: ellipsis; | ||
overflow: hidden; | ||
} | ||
|
||
p { | ||
text-overflow: ellipsis; | ||
overflow: hidden; | ||
} | ||
|
||
@media (max-width: 768px) { | ||
.card-item.bp5-card.bp5-elevation-2 { | ||
width: calc(100% - 10px); | ||
} | ||
} | ||
|
||
.card-item-actions { | ||
display: flex; | ||
margin-top: auto; | ||
justify-content: right; | ||
& > *:not(:first-child) { | ||
margin-left: 10px; | ||
} | ||
} | ||
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
101 changes: 101 additions & 0 deletions
101
app/src/pages/prefixes_page/components/AddPrefixDialog/index.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 |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import { | ||
Button, | ||
Callout, | ||
Dialog, | ||
DialogBody, | ||
DialogFooter, | ||
FormGroup, | ||
InputGroup, | ||
} from '@blueprintjs/core'; | ||
import { useRef, useState } from 'react'; | ||
import { Prefix } from '../../../../lib/api/prefix_api/types'; | ||
|
||
interface AddPrefixDialogProps { | ||
open: boolean; | ||
onClose: () => void; | ||
onCreate: (data: Prefix) => void; | ||
} | ||
|
||
const AddPrefixDialog = (props: AddPrefixDialogProps) => { | ||
const form_ref = useRef<HTMLFormElement>(null); | ||
|
||
const [error, setError] = useState<string | null>(null); | ||
|
||
const onClose = () => { | ||
props.onClose(); | ||
setError(null); | ||
}; | ||
|
||
const submit = (e: React.FormEvent<HTMLFormElement>) => { | ||
e.preventDefault(); | ||
if (!form_ref.current) return; | ||
setError(null); | ||
|
||
const { prefix_value, uri } = form_ref.current; | ||
|
||
if (!prefix_value || !uri) { | ||
setError('Please fill all fields'); | ||
return; | ||
} | ||
|
||
// Check if baseUri is a valid URI | ||
try { | ||
new URL(uri.value); | ||
} catch { | ||
setError('Invalid base URI'); | ||
return; | ||
} | ||
|
||
props.onCreate({ | ||
prefix: prefix_value.value, | ||
uri: uri.value, | ||
}); | ||
}; | ||
|
||
return ( | ||
<Dialog | ||
className='bp5-dark' | ||
isOpen={props.open} | ||
title='Add Prefix' | ||
onClose={onClose} | ||
> | ||
<form ref={form_ref} onSubmit={submit}> | ||
<DialogBody> | ||
{error && ( | ||
<Callout className='error-callout' intent='danger'> | ||
{error} | ||
</Callout> | ||
)} | ||
<FormGroup | ||
label='Prefix' | ||
labelFor='prefix_value' | ||
labelInfo='(required)' | ||
> | ||
<InputGroup id='prefix_value' name='prefix_value' required /> | ||
</FormGroup> | ||
<FormGroup label='URI' labelFor='uri' labelInfo='(required)'> | ||
<InputGroup id='uri' name='uri' type='url' required /> | ||
</FormGroup> | ||
</DialogBody> | ||
<DialogFooter | ||
actions={ | ||
<> | ||
<Button text='Cancel' onClick={onClose} /> | ||
<Button | ||
text='Create' | ||
intent='primary' | ||
onClick={() => | ||
form_ref.current?.dispatchEvent( | ||
new Event('submit', { cancelable: true, bubbles: true }), | ||
) | ||
} | ||
/> | ||
</> | ||
} | ||
/> | ||
</form> | ||
</Dialog> | ||
); | ||
}; | ||
|
||
export default AddPrefixDialog; |
32 changes: 32 additions & 0 deletions
32
app/src/pages/prefixes_page/components/PrefixCardItem/index.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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Button } from '@blueprintjs/core'; | ||
import CardItem from '../../../../components/CardItem'; | ||
import { Prefix } from '../../../../lib/api/prefix_api/types'; | ||
|
||
interface PrefixCardItemProps { | ||
prefix: Prefix; | ||
onDelete: (Prefix: Prefix) => void; | ||
} | ||
|
||
const PrefixCardItem = ({ prefix, onDelete }: PrefixCardItemProps) => { | ||
return ( | ||
<CardItem | ||
title={prefix.prefix} | ||
description={ | ||
<> | ||
<p> | ||
<b>URI</b>: {prefix.uri} | ||
</p> | ||
</> | ||
} | ||
actions={ | ||
<> | ||
<Button intent='danger' onClick={() => onDelete(prefix)}> | ||
Delete | ||
</Button> | ||
</> | ||
} | ||
/> | ||
); | ||
}; | ||
|
||
export default PrefixCardItem; |
Oops, something went wrong.