Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Mirador annotations
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
IIIF
Mirador
Mirador annotations
Commits
cd0ad56a
Commit
cd0ad56a
authored
1 year ago
by
Anthony
Browse files
Options
Downloads
Patches
Plain Diff
Simplify AnnotationFormManifestNetwork.js component
parent
e3dce09f
No related branches found
No related tags found
1 merge request
!10
Draft: MigratingAnnotationCreation to MUI5.
Pipeline
#1925
failed
1 year ago
Stage: test
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/annotationForm/AnnotationFormManifestNetwork.js
+4
-22
4 additions, 22 deletions
src/annotationForm/AnnotationFormManifestNetwork.js
src/utils.js
+12
-0
12 additions, 0 deletions
src/utils.js
with
16 additions
and
22 deletions
src/annotationForm/AnnotationFormManifestNetwork.js
+
4
−
22
View file @
cd0ad56a
...
@@ -3,25 +3,10 @@ import {
...
@@ -3,25 +3,10 @@ import {
Grid
,
Paper
,
TextField
,
Typography
,
Button
,
Link
,
Grid
,
Paper
,
TextField
,
Typography
,
Button
,
Link
,
}
from
'
@mui/material
'
;
}
from
'
@mui/material
'
;
import
PropTypes
from
'
prop-types
'
;
import
PropTypes
from
'
prop-types
'
;
import
{
isValidUrl
}
from
'
../utils
'
;
/** Form part for edit annotation content and body */
/** Form part for edit annotation content and body */
function
AnnotationFormNetwork
({
manifestNetwork
,
updateManifestNetwork
})
{
function
AnnotationFormNetwork
({
manifestNetwork
,
updateManifestNetwork
})
{
const
isValidUrl
=
(
string
)
=>
{
if
(
string
===
''
)
{
return
true
;
}
try
{
new
URL
(
string
);
return
true
;
}
catch
(
_
)
{
return
false
;
}
};
const
onChangeManifestNetworkInput
=
(
event
)
=>
{
updateManifestNetwork
(
event
.
target
.
value
.
trim
());
};
return
(
return
(
<
Paper
style
=
{{
padding
:
'
5px
'
}}
>
<
Paper
style
=
{{
padding
:
'
5px
'
}}
>
<
Typography
variant
=
"
overline
"
>
<
Typography
variant
=
"
overline
"
>
...
@@ -30,22 +15,19 @@ function AnnotationFormNetwork({ manifestNetwork, updateManifestNetwork }) {
...
@@ -30,22 +15,19 @@ function AnnotationFormNetwork({ manifestNetwork, updateManifestNetwork }) {
<
Grid
>
<
Grid
>
<
TextField
<
TextField
value
=
{
manifestNetwork
}
value
=
{
manifestNetwork
}
onChange
=
{
onChangeManifestNetworkInput
}
onChange
=
{
(
event
)
=>
updateManifestNetwork
(
event
.
target
.
value
.
trim
())
}
label
=
"
Manifest URL
"
label
=
"
Manifest URL
"
type
=
"
url
"
type
=
"
url
"
/>
/>
{
{
isValidUrl
(
manifestNetwork
)
&&
(
isValidUrl
(
manifestNetwork
)
?
(
<
Link
<
Link
href
=
{
manifestNetwork
}
href
=
{
manifestNetwork
}
target
=
"
_blank
"
target
=
"
_blank
"
>
>
{
manifestNetwork
}
{
manifestNetwork
}
<
/Link
>
<
/Link
>
)
)
:
(
}
{
!
isValidUrl
(
manifestNetwork
)
&&
(
<
Typography
variant
=
"
caption
"
>
<
Typography
variant
=
"
caption
"
>
Not
a
valid
URL
Not
a
valid
URL
<
/Typography
>
<
/Typography
>
...
...
This diff is collapsed.
Click to expand it.
src/utils.js
+
12
−
0
View file @
cd0ad56a
...
@@ -26,3 +26,15 @@ export function secondsToHMSarray(secs) {
...
@@ -26,3 +26,15 @@ export function secondsToHMSarray(secs) {
seconds
:
secs
%
60
,
seconds
:
secs
%
60
,
};
};
}
}
export
const
isValidUrl
=
(
string
)
=>
{
if
(
string
===
''
)
{
return
true
;
}
try
{
new
URL
(
string
);
return
true
;
}
catch
(
_
)
{
return
false
;
}
};
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment