-
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.
Merge pull request #361 from AppQuality/develop
Improve video cutting and add debounce to bookmark update
- Loading branch information
Showing
12 changed files
with
280 additions
and
22 deletions.
There are no files selected for viewing
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.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import { theme } from "../../theme"; | ||
import { Span } from "../../typography/span"; | ||
import { ReactComponent as Sentiment1 } from "../../../assets/icons/sentiment-1.svg"; | ||
import { ReactComponent as Sentiment2 } from "../../../assets/icons/sentiment-2.svg"; | ||
import { ReactComponent as Sentiment3 } from "../../../assets/icons/sentiment-3.svg"; | ||
import { ReactComponent as Sentiment4 } from "../../../assets/icons/sentiment-4.svg"; | ||
import { ReactComponent as Sentiment5 } from "../../../assets/icons/sentiment-5.svg"; | ||
import styled from "styled-components"; | ||
|
||
const StyledDiv = styled.div` | ||
svg { | ||
width: ${({ theme }) => theme.space.sm}; | ||
height: ${({ theme }) => theme.space.sm}; | ||
margin-right: ${(p) => p.theme.space.xs}; | ||
flex-shrink: 0; | ||
} | ||
`; | ||
|
||
export const getSentiment = (value: number) => { | ||
switch (value) { | ||
case 1: | ||
return { | ||
color: theme.palette.red[500], | ||
text: ( | ||
<StyledDiv> | ||
<Sentiment1 />{" "} | ||
<Span style={{ whiteSpace: "nowrap" }}>Very Negative</Span> | ||
</StyledDiv> | ||
), | ||
}; | ||
case 2: | ||
return { | ||
color: theme.palette.red[500], | ||
text: ( | ||
<StyledDiv> | ||
<Sentiment2 />{" "} | ||
<Span style={{ whiteSpace: "nowrap" }}>Negative</Span> | ||
</StyledDiv> | ||
), | ||
}; | ||
case 3: | ||
return { | ||
color: theme.palette.yellow[500], | ||
text: ( | ||
<StyledDiv> | ||
<Sentiment3 /> <Span style={{ whiteSpace: "nowrap" }}>Neutral</Span> | ||
</StyledDiv> | ||
), | ||
}; | ||
case 4: | ||
return { | ||
color: theme.palette.green[500], | ||
text: ( | ||
<StyledDiv> | ||
<Sentiment4 />{" "} | ||
<Span style={{ whiteSpace: "nowrap" }}>Positive</Span> | ||
</StyledDiv> | ||
), | ||
}; | ||
case 5: | ||
return { | ||
color: theme.palette.green[500], | ||
text: ( | ||
<StyledDiv> | ||
<Sentiment5 />{" "} | ||
<Span style={{ whiteSpace: "nowrap" }}>Very Positive</Span> | ||
</StyledDiv> | ||
), | ||
}; | ||
|
||
default: | ||
return { | ||
color: theme.palette.yellow[500], | ||
text: "", | ||
}; | ||
} | ||
}; |
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,71 @@ | ||
import { styled } from "styled-components"; | ||
import { Highlight } from ".."; | ||
import { formatDuration } from "../../player/parts/utils"; | ||
import { SM } from "../../typography/typescale"; | ||
import { StoryArgs } from "../index.stories"; | ||
import { DemoTranscript as demo, DemoSentiment } from "./data"; | ||
import { getSentiment } from "./sentiment-tag"; | ||
import { Textarea } from "../../forms/textarea"; | ||
|
||
const StyledDiv = styled.div` | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
margin-bottom: ${({ theme }) => theme.space.sm}; | ||
`; | ||
|
||
export const TSentiment = ( | ||
args: StoryArgs & { currentTime: number; offset: number } | ||
) => { | ||
const words = demo.results.channels[0].alternatives[0].words.map((w) => ({ | ||
word: w.punctuated_word, | ||
start: w.start, | ||
end: w.end, | ||
speaker: w.speaker, | ||
})); | ||
const paragraphs = | ||
demo.results.channels[0].alternatives[0].paragraphs.paragraphs.map((w) => ({ | ||
words: words.filter((word) => word.start >= w.start && word.end <= w.end), | ||
start: w.start, | ||
end: w.end, | ||
speaker: w.speaker, | ||
text: w.sentences.map((s) => s.text).join(" "), | ||
sentiment: w.sentiment, | ||
})); | ||
return ( | ||
<Highlight {...args}> | ||
Overall: 4 - Positive | ||
<Textarea | ||
readOnly | ||
disabled | ||
style={{ margin: 0 }} | ||
value={DemoSentiment.content} | ||
rows={4} | ||
/> | ||
<br /> | ||
<br /> | ||
{paragraphs.map((p, index) => ( | ||
<div style={{ marginBottom: "8px" }}> | ||
<StyledDiv> | ||
<SM> | ||
<b>{p.speaker === 1 ? "Tester" : "Interviewer"}</b> ( | ||
{formatDuration(p.start - args.offset)} -{" "} | ||
{formatDuration(p.end - args.offset)}) | ||
</SM> | ||
{p.sentiment && getSentiment(p.sentiment).text} | ||
</StyledDiv> | ||
{p.words.map((w) => ( | ||
<Highlight.Word | ||
key={index} | ||
start={w.start} | ||
end={w.end} | ||
currentTime={args.currentTime} | ||
text={w.word} | ||
/> | ||
))} | ||
</div> | ||
))} | ||
</Highlight> | ||
); | ||
}; |
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
Oops, something went wrong.