Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Dominik Schwabe
comparefile
Commits
f3521619
Commit
f3521619
authored
Jun 22, 2021
by
Dominik Schwabe
Browse files
fixed react warnings
parent
3b81a76d
Changes
6
Hide whitespace changes
Inline
Side-by-side
frontend/src/components/Saved.js
View file @
f3521619
import
React
,
{
useEffect
,
useState
}
from
"
react
"
;
import
React
from
"
react
"
;
import
{
FaQuestionCircle
}
from
"
react-icons/fa
"
;
import
{
SavedInfo
}
from
"
./SavedInfo
"
;
...
...
frontend/src/components/SavedInfo.js
View file @
f3521619
import
React
,
{
useCallback
,
useEffect
,
useMemo
,
useRef
,
useState
}
from
"
react
"
;
import
React
,
{
useCallback
,
useEffect
,
useRef
,
useState
}
from
"
react
"
;
import
UIkit
from
"
uikit
"
;
import
{
flatten
}
from
"
../utils/flatScores
"
;
...
...
frontend/src/components/Summarize.js
View file @
f3521619
import
isURL
from
"
is-url
"
;
import
React
,
{
useCallback
,
useContext
,
useEffect
,
useMemo
,
useReducer
,
useState
}
from
"
react
"
;
import
React
,
{
useCallback
,
useContext
,
useMemo
,
useReducer
,
useState
}
from
"
react
"
;
import
{
CSSTransition
}
from
"
react-transition-group
"
;
import
{
feedbackRequest
,
summarizeRequest
}
from
"
../api
"
;
...
...
@@ -216,7 +215,7 @@ const generateStatistics = (text, summaryMarkup) => {
};
const
Summary
=
({
markup
,
summary
,
markupState
,
scrollState
,
showMarkup
})
=>
{
const
{
originalText
,
summaryText
}
=
summary
;
const
{
originalText
}
=
summary
;
const
{
numWords
,
percentOverlap
}
=
generateStatistics
(
originalText
,
markup
[
1
]);
return
(
...
...
frontend/src/components/Visualize.js
View file @
f3521619
...
...
@@ -246,7 +246,7 @@ const VisualizeContent = ({ doc, reference, models }) => {
if
(
slot
===
null
)
return
null
if
(
referenceSelected
)
return
reference
return
models
[
slot
][
1
]
},
[
slot
])
},
[
slot
,
models
,
reference
,
referenceSelected
])
const
[
docMarkup
,
refMarkup
]
=
useMarkup
(
doc
,
ref
)
const
markupState
=
useState
(
null
);
...
...
frontend/src/components/utils/Markup.js
View file @
f3521619
import
React
,
{
memo
,
useCallback
,
useEffect
,
useMemo
,
useRef
,
useState
}
from
"
react
"
;
import
React
,
{
Fragment
,
memo
,
useCallback
,
useEffect
,
useRef
,
useState
}
from
"
react
"
;
const
innerHoverStyle
=
{
background
:
"
yellow
"
,
color
:
"
black
"
,
display
:
"
relative
"
};
const
baseMarkupStyle
=
{
...
...
@@ -12,7 +12,7 @@ const outerHoverStyle = { ...baseMarkupStyle, ...innerHoverStyle };
const
initScrollState
=
[
null
,
null
,
null
];
const
useMarkupScroll
=
()
=>
{
const
[
scrollState
,
setScrollState
]
=
useState
(
initScrollState
);
const
resetScrollState
=
useCallback
(()
=>
setScrollState
(
initScrollState
));
const
resetScrollState
=
useCallback
(()
=>
setScrollState
(
initScrollState
)
,
[
setScrollState
]
);
return
[
scrollState
,
setScrollState
,
resetScrollState
];
};
...
...
@@ -31,7 +31,7 @@ const Scroll = ({ docIndex, matchOrder, groupSizes, tag, scrollState, allowScrol
if
(
docIndex
===
scrollMarkup
[
0
]
&&
tag
===
scrollMarkup
[
1
]
&&
matchOrder
===
scrollMarkup
[
2
])
{
scrollRef
.
current
.
scrollIntoView
({
block
:
"
center
"
,
behavior
:
"
smooth
"
,
inline
:
"
start
"
});
}
},
[
scrollMarkup
,
docIndex
,
matchOrder
]);
},
[
tag
,
scrollMarkup
,
docIndex
,
matchOrder
]);
return
(
<
span
ref
=
{
scrollRef
}
onClick
=
{
scrollNext
}
>
{
children
}
...
...
@@ -84,11 +84,11 @@ const StringContent = memo(({ content }) => {
return
(
<
span
>
<>
{
lines
[
0
]}
<
/
>
{
lines
.
slice
(
1
).
map
((
line
)
=>
(
<>
{
lines
.
slice
(
1
).
map
((
line
,
i
)
=>
(
<
Fragment
key
=
{
i
}
>
<
br
/>
{
line
}
<
/
>
<
/
Fragment
>
))}
<
/span
>
);
...
...
@@ -96,10 +96,9 @@ const StringContent = memo(({ content }) => {
const
MarkupRoot
=
({
markups
,
markupState
,
scrollState
,
allowScroll
,
showMarkup
})
=>
(
<>
{
markups
.
map
((
child
,
i
)
=>
typeof
child
===
"
string
"
?
(
<
StringContent
key
=
{
i
}
content
=
{
child
}
/
>
)
:
(
{
markups
.
map
((
child
,
i
)
=>
{
if
(
typeof
child
===
"
string
"
)
return
<
StringContent
key
=
{
i
}
content
=
{
child
}
/>
;
return
(
<
TaggedMarkup
key
=
{
i
}
markup
=
{
child
}
...
...
@@ -108,8 +107,8 @@ const MarkupRoot = ({ markups, markupState, scrollState, allowScroll, showMarkup
allowScroll
=
{
allowScroll
}
showMarkup
=
{
showMarkup
}
/
>
)
)}
)
;
}
)}
<
/
>
);
...
...
frontend/src/contexts/SettingsContext.js
View file @
f3521619
...
...
@@ -14,12 +14,12 @@ const SettingsProvider = ({ children }) => {
const
newValue
=
!
allowSelfSimilarities
setAllowSelfSimilarities
(
newValue
);
storeAllowSelfSimilarities
(
newValue
);
});
}
,
[
allowSelfSimilarities
,
setAllowSelfSimilarities
]
);
const
setMinOverlap
=
useCallback
((
overlap
)
=>
{
const
newOverlap
=
typeof
overlap
===
"
string
"
?
parseInt
(
overlap
,
10
)
:
overlap
_setMinOverlap
(
newOverlap
);
storeMinOverlap
(
newOverlap
);
});
}
,
[
_setMinOverlap
]
);
return
(
<
SettingsContext
.
Provider
value
=
{{
minOverlap
,
setMinOverlap
,
allowSelfSimilarities
,
toggleAllowSelfSimilarities
}}
>
{
children
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment