mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-19 16:15:04 +00:00
Merge pull request #198 from storytold/bflat-fy-comments-2
comments section update
This commit is contained in:
13 files changed
+258
-121
No files matched your search
@@ -7,7 +7,7 @@ interface Props {
|
||||
}
|
||||
|
||||
function Gravatar(props: Props) {
|
||||
const gravatarUrl = `https://www.gravatar.com/avatar/${props.email_hash}?s=${props.size}`;
|
||||
const gravatarUrl = `https://www.gravatar.com/avatar/${props.email_hash}?s=${props.size}&d=https://fakeyou.com/images/avatars/default-pfp.png`;
|
||||
|
||||
let altText = "gravatar";
|
||||
if (props.username !== undefined) {
|
||||
@@ -16,9 +16,11 @@ function Gravatar(props: Props) {
|
||||
|
||||
return (
|
||||
<img
|
||||
className="rounded-circle border border-3"
|
||||
className="rounded-circle border border-2 h-100 gravatar-img"
|
||||
alt={altText}
|
||||
src={gravatarUrl}
|
||||
height={props.size}
|
||||
width={props.size}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
@@ -1029,6 +1029,34 @@ styles with important tags:
|
||||
|
||||
.textarea-comment {
|
||||
resize: none;
|
||||
overflow-x: none;
|
||||
}
|
||||
|
||||
.btn-comment {
|
||||
padding: 8px 20px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.btn-link-white {
|
||||
color: $white;
|
||||
opacity: 0.75;
|
||||
|
||||
&:hover {
|
||||
color: $white;
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
.btn-link-small {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.comment-time {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.gravatar-img {
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ function CommentComponent(props: Props) {
|
||||
}, [loadComments]);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="d-flex flex-column gap-4">
|
||||
<CreateCommentForm
|
||||
entityType={props.entityType}
|
||||
entityToken={props.entityToken}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import React from "react";
|
||||
import { formatDistance } from "date-fns";
|
||||
import {
|
||||
Comment,
|
||||
} from "@storyteller/components/src/api/comments/ListComments";
|
||||
import { Comment } from "@storyteller/components/src/api/comments/ListComments";
|
||||
import { SessionWrapper } from "@storyteller/components/src/session/SessionWrapper";
|
||||
import { SafeDeleteCommentButton } from "./SafeDeleteCommentButton";
|
||||
|
||||
const Fade = require("react-reveal/Fade");
|
||||
import { motion } from "framer-motion";
|
||||
import { container, item } from "../../../../data/animation";
|
||||
import { Gravatar } from "@storyteller/components/src/elements/Gravatar";
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
interface Props {
|
||||
entityType: string;
|
||||
@@ -17,13 +17,12 @@ interface Props {
|
||||
}
|
||||
|
||||
/**
|
||||
* This is part of a reusable component for putting comments on several
|
||||
* This is part of a reusable component for putting comments on several
|
||||
* different page types.
|
||||
*
|
||||
* See the documentation on the parent <CommentComponent />
|
||||
*/
|
||||
function CommentList(props: Props) {
|
||||
|
||||
// NB: It's more convenient to show recent data first {.reverse()}
|
||||
var reversedComments = props.comments.slice();
|
||||
|
||||
@@ -37,9 +36,9 @@ function CommentList(props: Props) {
|
||||
addSuffix: true,
|
||||
});
|
||||
|
||||
// TODO: We'll soon add backend support for a third party that can delete
|
||||
// comments - the person that owns the thing the comment is attached to.
|
||||
// We want profile / model / result owner to be able to clear harassing
|
||||
// TODO: We'll soon add backend support for a third party that can delete
|
||||
// comments - the person that owns the thing the comment is attached to.
|
||||
// We want profile / model / result owner to be able to clear harassing
|
||||
// comments themselves. This isn't ready yet, though.
|
||||
const isAuthor = props.sessionWrapper.userTokenMatches(comment.user_token);
|
||||
const isModerator = props.sessionWrapper.canBanUsers();
|
||||
@@ -49,52 +48,62 @@ function CommentList(props: Props) {
|
||||
if (canDelete) {
|
||||
maybeDeleteButton = (
|
||||
<>
|
||||
<span>·</span>
|
||||
<SafeDeleteCommentButton
|
||||
commentToken={comment.token}
|
||||
loadComments={props.loadComments}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
let profileLink = `/profile/${comment.username}`;
|
||||
|
||||
rows.push(
|
||||
<tr key={comment.token}>
|
||||
<td>
|
||||
<div className="py-2">
|
||||
<motion.tr key={comment.token} variants={item}>
|
||||
<td className="px-0">
|
||||
<div className="d-flex gap-3 py-3">
|
||||
<Gravatar size={40} email_hash={comment.user_gravatar_hash} />
|
||||
<div>
|
||||
<span className="fw-medium text-white">
|
||||
{comment.user_display_name}
|
||||
</span>
|
||||
<span className="px-2">·</span>
|
||||
<span className="opacity-75">{relativeCreateTime}</span>
|
||||
</div>
|
||||
{/*
|
||||
<div className="d-flex gap-2 align-items-center">
|
||||
<Link to={profileLink} className="fw-medium text-white">
|
||||
{comment.user_display_name}
|
||||
</Link>
|
||||
<span>·</span>
|
||||
<span className="opacity-75 comment-time">
|
||||
{relativeCreateTime}
|
||||
</span>
|
||||
|
||||
{maybeDeleteButton}
|
||||
</div>
|
||||
{/*
|
||||
It's okay to set "dangerous" html here as the server safely created
|
||||
it from markdown and shields against user injection attempts. Don't
|
||||
do this with other server data, though, unless you know that field
|
||||
is safe from the backend engineers.
|
||||
*/}
|
||||
<div
|
||||
className="mt-1 text-center text-lg-start"
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: comment.comment_rendered_html || "",
|
||||
}}
|
||||
/>
|
||||
{maybeDeleteButton}
|
||||
<div
|
||||
className="mt-1"
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: comment.comment_rendered_html || "",
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</motion.tr>
|
||||
);
|
||||
});
|
||||
|
||||
return (
|
||||
<div>
|
||||
<table className="table">
|
||||
<Fade cascade bottom duration="200" distance="10px">
|
||||
<tbody>{rows}</tbody>
|
||||
</Fade>
|
||||
</table>
|
||||
</div>
|
||||
<motion.table
|
||||
className="table mb-0"
|
||||
initial="hidden"
|
||||
animate="visible"
|
||||
variants={container}
|
||||
>
|
||||
<tbody>{rows}</tbody>
|
||||
</motion.table>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
} from "@storyteller/components/src/api/comments/CreateComment";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import { SessionWrapper } from "@storyteller/components/src/session/SessionWrapper";
|
||||
import { Gravatar } from "@storyteller/components/src/elements/Gravatar";
|
||||
|
||||
interface Props {
|
||||
entityType: string;
|
||||
@@ -14,13 +15,13 @@ interface Props {
|
||||
}
|
||||
|
||||
/**
|
||||
* This is part of a reusable component for putting comments on several
|
||||
* This is part of a reusable component for putting comments on several
|
||||
* different page types.
|
||||
*
|
||||
* See the documentation on the parent <CommentComponent />
|
||||
*/
|
||||
function CreateCommentForm(props: Props) {
|
||||
const {entityType, entityToken, loadComments} = props;
|
||||
const { entityType, entityToken, loadComments } = props;
|
||||
|
||||
const [commentMarkdown, setCommentMarkdown] = useState<string>("");
|
||||
const [uuidIdempotencyToken, setUuidIdempotencyToken] = useState<string>(
|
||||
@@ -67,21 +68,48 @@ function CreateCommentForm(props: Props) {
|
||||
}
|
||||
|
||||
postComment();
|
||||
const form = ev.target;
|
||||
form.reset();
|
||||
setButtonVisible(false);
|
||||
return false;
|
||||
};
|
||||
|
||||
const handleKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {
|
||||
if (event.key === "Enter") {
|
||||
event.preventDefault();
|
||||
const handleKeyDown = (ev: React.KeyboardEvent<HTMLTextAreaElement>) => {
|
||||
if (ev.key === "Enter") {
|
||||
ev.preventDefault();
|
||||
}
|
||||
};
|
||||
|
||||
const handleCancelButton = (ev: any) => {
|
||||
ev.preventDefault();
|
||||
const commentTextArea = document.getElementById(
|
||||
"comment-textarea"
|
||||
) as HTMLTextAreaElement;
|
||||
commentTextArea.value = "";
|
||||
setButtonVisible(false);
|
||||
};
|
||||
|
||||
let gravatarHash = props.sessionWrapper.getEmailGravatarHash();
|
||||
let gravatar = <span />;
|
||||
if (gravatarHash !== undefined) {
|
||||
gravatar = <Gravatar email_hash={gravatarHash} size={40} />;
|
||||
}
|
||||
|
||||
let commentButton = <></>;
|
||||
if (buttonVisible) {
|
||||
commentButton = (
|
||||
<button type="submit" className="btn btn-primary">
|
||||
Post Comment
|
||||
</button>
|
||||
<div className="d-flex w-100 justify-content-end">
|
||||
<button
|
||||
type="reset"
|
||||
className="btn btn-link btn-link-white"
|
||||
onClick={handleCancelButton}
|
||||
>
|
||||
Cancel
|
||||
</button>
|
||||
<button type="submit" className="btn btn-primary btn-comment">
|
||||
Post Comment
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -98,18 +126,23 @@ function CreateCommentForm(props: Props) {
|
||||
if (props.sessionWrapper.isLoggedIn()) {
|
||||
createCommentComponent = (
|
||||
<form onSubmit={handleFormSubmit}>
|
||||
<div className="d-flex gap-3">
|
||||
<div className="form-group flex-grow-1">
|
||||
<textarea
|
||||
placeholder="Add a comment..."
|
||||
className="form-control textarea-comment"
|
||||
rows={1}
|
||||
onChange={handleCommentChange}
|
||||
onKeyDown={handleKeyDown}
|
||||
>
|
||||
{commentMarkdown}
|
||||
</textarea>
|
||||
<div className="d-flex flex-column gap-3">
|
||||
<div className="d-flex gap-3 align-items-center">
|
||||
{gravatar}
|
||||
<div className="form-group flex-grow-1">
|
||||
<textarea
|
||||
placeholder="Add a comment..."
|
||||
className="form-control textarea-comment"
|
||||
rows={1}
|
||||
onChange={handleCommentChange}
|
||||
onKeyDown={handleKeyDown}
|
||||
id="comment-textarea"
|
||||
>
|
||||
{commentMarkdown}
|
||||
</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{commentButton}
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import React, { useState } from "react";
|
||||
import { DeleteComment, DeleteCommentIsOk } from "@storyteller/components/src/api/comments/DeleteComment";
|
||||
import {
|
||||
DeleteComment,
|
||||
DeleteCommentIsOk,
|
||||
} from "@storyteller/components/src/api/comments/DeleteComment";
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
import { faTrash, faTrashRestore } from "@fortawesome/free-solid-svg-icons";
|
||||
import { faTrashCheck } from "@fortawesome/pro-solid-svg-icons";
|
||||
|
||||
interface Props {
|
||||
@@ -10,7 +12,7 @@ interface Props {
|
||||
}
|
||||
|
||||
/**
|
||||
* This is part of a reusable component for putting comments on several
|
||||
* This is part of a reusable component for putting comments on several
|
||||
* different page types.
|
||||
*
|
||||
* See the documentation on the parent <CommentComponent />
|
||||
@@ -27,41 +29,41 @@ function SafeDeleteCommentButton(props: Props) {
|
||||
|
||||
let deleteButton = <></>;
|
||||
|
||||
// We ask the user to confirm the deletion.
|
||||
// We ask the user to confirm the deletion.
|
||||
// This makes it slightly safer and prevents accidental mis-clicks.
|
||||
if (!readyToDelete) {
|
||||
deleteButton = (
|
||||
<>
|
||||
<button onClick={() => setReadyToDelete(true)}>
|
||||
<FontAwesomeIcon icon={faTrash} />
|
||||
{" "}
|
||||
Delete Comment
|
||||
<button
|
||||
onClick={() => setReadyToDelete(true)}
|
||||
className="btn-link btn-link-small p-0 fw-medium"
|
||||
>
|
||||
Delete
|
||||
</button>
|
||||
</>
|
||||
)
|
||||
);
|
||||
} else {
|
||||
deleteButton = (
|
||||
<>
|
||||
<button onClick={() => setReadyToDelete(false)}>
|
||||
<FontAwesomeIcon icon={faTrashRestore} />
|
||||
{" "}
|
||||
<button
|
||||
onClick={() => setReadyToDelete(false)}
|
||||
className="btn-link btn-link-small btn-link-white p-0 me-2 fw-medium"
|
||||
>
|
||||
Cancel
|
||||
</button>
|
||||
|
||||
<button onClick={async () => await handleDeleteComment(props.commentToken)}>
|
||||
<FontAwesomeIcon icon={faTrashCheck} />
|
||||
{" "}
|
||||
Confirm Comment
|
||||
<button
|
||||
onClick={async () => await handleDeleteComment(props.commentToken)}
|
||||
className="btn-link btn-link-small p-0 fw-medium"
|
||||
>
|
||||
<FontAwesomeIcon icon={faTrashCheck} className="me-2" />
|
||||
Confirm Delete
|
||||
</button>
|
||||
</>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{deleteButton}
|
||||
</>
|
||||
)
|
||||
return <>{deleteButton}</>;
|
||||
}
|
||||
|
||||
export { SafeDeleteCommentButton };
|
||||
@@ -106,18 +106,20 @@ function FirehoseEventListPage(props: Props) {
|
||||
let link = `/profile/${event.maybe_target_username}`;
|
||||
userLink = <Link to={link}>{event.maybe_target_display_name}</Link>;
|
||||
gravatar = (
|
||||
<Gravatar
|
||||
size={15}
|
||||
username={event.maybe_target_username}
|
||||
email_hash={event.maybe_target_user_gravatar_hash}
|
||||
/>
|
||||
<div className="me-1">
|
||||
<Gravatar
|
||||
size={22}
|
||||
username={event.maybe_target_username}
|
||||
email_hash={event.maybe_target_user_gravatar_hash}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
switch (event.event_type) {
|
||||
case "user_sign_up":
|
||||
inner = (
|
||||
<span>
|
||||
<span className="d-flex align-items-center">
|
||||
<FontAwesomeIcon icon={faPenToSquare} className="me-3" />
|
||||
{gravatar}
|
||||
|
||||
@@ -128,7 +130,7 @@ function FirehoseEventListPage(props: Props) {
|
||||
break;
|
||||
case "user_badge_granted":
|
||||
inner = (
|
||||
<span>
|
||||
<span className="d-flex align-items-center">
|
||||
<FontAwesomeIcon icon={faAward} className="me-3" />
|
||||
{gravatar}
|
||||
|
||||
@@ -139,7 +141,7 @@ function FirehoseEventListPage(props: Props) {
|
||||
break;
|
||||
case "tts_model_upload_started":
|
||||
inner = (
|
||||
<span>
|
||||
<span className="d-flex align-items-center">
|
||||
<FontAwesomeIcon icon={faPlay} className="me-3" />
|
||||
{gravatar}
|
||||
|
||||
@@ -150,7 +152,7 @@ function FirehoseEventListPage(props: Props) {
|
||||
break;
|
||||
case "tts_model_upload_completed":
|
||||
inner = (
|
||||
<span>
|
||||
<span className="d-flex align-items-center">
|
||||
<FontAwesomeIcon icon={faFlagCheckered} className="me-3" />
|
||||
{gravatar}
|
||||
|
||||
@@ -161,7 +163,7 @@ function FirehoseEventListPage(props: Props) {
|
||||
break;
|
||||
case "tts_inference_started":
|
||||
inner = (
|
||||
<span>
|
||||
<span className="d-flex align-items-center">
|
||||
<FontAwesomeIcon icon={faPlay} className="me-3" />
|
||||
{gravatar}
|
||||
|
||||
@@ -172,7 +174,7 @@ function FirehoseEventListPage(props: Props) {
|
||||
break;
|
||||
case "tts_inference_completed":
|
||||
inner = (
|
||||
<span>
|
||||
<span className="d-flex align-items-center">
|
||||
<FontAwesomeIcon icon={faFlagCheckered} className="me-3" />
|
||||
{gravatar}
|
||||
|
||||
@@ -183,7 +185,7 @@ function FirehoseEventListPage(props: Props) {
|
||||
break;
|
||||
case "w2l_template_upload_started":
|
||||
inner = (
|
||||
<span>
|
||||
<span className="d-flex align-items-center">
|
||||
<FontAwesomeIcon icon={faPlay} className="me-3" />
|
||||
{gravatar}
|
||||
|
||||
@@ -194,7 +196,7 @@ function FirehoseEventListPage(props: Props) {
|
||||
break;
|
||||
case "w2l_template_upload_completed":
|
||||
inner = (
|
||||
<span>
|
||||
<span className="d-flex align-items-center">
|
||||
<FontAwesomeIcon icon={faFlagCheckered} className="me-3" />
|
||||
{gravatar}
|
||||
|
||||
@@ -205,7 +207,7 @@ function FirehoseEventListPage(props: Props) {
|
||||
break;
|
||||
case "w2l_inference_started":
|
||||
inner = (
|
||||
<span>
|
||||
<span className="d-flex align-items-center">
|
||||
<FontAwesomeIcon icon={faPlay} className="me-3" />
|
||||
{gravatar}
|
||||
|
||||
@@ -216,7 +218,7 @@ function FirehoseEventListPage(props: Props) {
|
||||
break;
|
||||
case "w2l_inference_completed":
|
||||
inner = (
|
||||
<span>
|
||||
<span className="d-flex align-items-center">
|
||||
<FontAwesomeIcon icon={faFlagCheckered} className="me-3" />
|
||||
{gravatar}
|
||||
|
||||
@@ -227,7 +229,7 @@ function FirehoseEventListPage(props: Props) {
|
||||
break;
|
||||
case "twitter_mention":
|
||||
inner = (
|
||||
<span>
|
||||
<span className="d-flex align-items-center">
|
||||
<FontAwesomeIcon icon={faTwitter} className="me-3" />
|
||||
{gravatar}
|
||||
|
||||
@@ -238,7 +240,7 @@ function FirehoseEventListPage(props: Props) {
|
||||
break;
|
||||
case "twitter_retweet":
|
||||
inner = (
|
||||
<span>
|
||||
<span className="d-flex align-items-center">
|
||||
<FontAwesomeIcon icon={faTwitter} className="me-3" />
|
||||
{gravatar}
|
||||
|
||||
@@ -249,7 +251,7 @@ function FirehoseEventListPage(props: Props) {
|
||||
break;
|
||||
case "discord_join":
|
||||
inner = (
|
||||
<span>
|
||||
<span className="d-flex align-items-center">
|
||||
<FontAwesomeIcon icon={faDiscord} className="me-3" />
|
||||
{gravatar}
|
||||
|
||||
@@ -260,7 +262,7 @@ function FirehoseEventListPage(props: Props) {
|
||||
break;
|
||||
case "discord_message":
|
||||
inner = (
|
||||
<span>
|
||||
<span className="d-flex align-items-center">
|
||||
<FontAwesomeIcon icon={faDiscord} className="me-3" />
|
||||
{gravatar}
|
||||
|
||||
@@ -271,7 +273,7 @@ function FirehoseEventListPage(props: Props) {
|
||||
break;
|
||||
case "twitch_subscribe":
|
||||
inner = (
|
||||
<span>
|
||||
<span className="d-flex align-items-center">
|
||||
<FontAwesomeIcon icon={faTwitch} className="me-3" />
|
||||
{gravatar}
|
||||
|
||||
@@ -282,7 +284,7 @@ function FirehoseEventListPage(props: Props) {
|
||||
break;
|
||||
case "twitch_follow":
|
||||
inner = (
|
||||
<span>
|
||||
<span className="d-flex align-items-center">
|
||||
<FontAwesomeIcon icon={faTwitch} className="me-3" />
|
||||
{gravatar}
|
||||
|
||||
|
||||
@@ -535,7 +535,7 @@ function ProfilePage(this: any, props: Props) {
|
||||
role="tabpanel"
|
||||
aria-labelledby="comments-tab"
|
||||
>
|
||||
<div className="d-flex flex-column gap-3">
|
||||
<div className="mt-3 mt-lg-0">
|
||||
<CommentComponent
|
||||
entityType="user"
|
||||
entityToken={userData?.user_token}
|
||||
|
||||
@@ -64,6 +64,7 @@ import { Analytics } from "../../../../../common/Analytics";
|
||||
import { usePrefixedDocumentTitle } from "../../../../../common/UsePrefixedDocumentTitle";
|
||||
import { RatingButtons } from "../../../_common/ratings/RatingButtons";
|
||||
import { RatingStats } from "../../../_common/ratings/RatingStats";
|
||||
import { CommentComponent } from "../../../_common/comments/CommentComponent";
|
||||
|
||||
interface Props {
|
||||
sessionWrapper: SessionWrapper;
|
||||
@@ -530,11 +531,17 @@ function TtsModelViewPage(props: Props) {
|
||||
|
||||
<tr>
|
||||
<th>Use global m-factor? (default no)</th>
|
||||
<td>{ttsModel?.maybe_moderator_fields?.use_default_m_factor ? "yes" : "no"}</td>
|
||||
<td>
|
||||
{ttsModel?.maybe_moderator_fields?.use_default_m_factor
|
||||
? "yes"
|
||||
: "no"}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Custom m-factor (optional)</th>
|
||||
<td>{ttsModel?.maybe_moderator_fields?.maybe_custom_m_factor}</td>
|
||||
<td>
|
||||
{ttsModel?.maybe_moderator_fields?.maybe_custom_m_factor}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -666,11 +673,11 @@ function TtsModelViewPage(props: Props) {
|
||||
let ratingButtons = <></>;
|
||||
if (props.sessionWrapper.isLoggedIn()) {
|
||||
ratingButtons = (
|
||||
<RatingButtons
|
||||
entity_type="tts_model"
|
||||
entity_token={ttsModel?.model_token || ""}
|
||||
<RatingButtons
|
||||
entity_type="tts_model"
|
||||
entity_token={ttsModel?.model_token || ""}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// NB: Investors might not like the in-your-face "over 1 year ago" dates.
|
||||
@@ -690,10 +697,9 @@ function TtsModelViewPage(props: Props) {
|
||||
|
||||
<RatingStats
|
||||
positive_votes={ttsModel?.user_ratings?.positive_count || 0}
|
||||
negative_votes={ttsModel?.user_ratings?.negative_count || 0 }
|
||||
negative_votes={ttsModel?.user_ratings?.negative_count || 0}
|
||||
total_votes={ttsModel?.user_ratings?.total_count || 0}
|
||||
/>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<motion.div className="mb-3 mt-4 pt-2" variants={item}>
|
||||
@@ -815,6 +821,19 @@ function TtsModelViewPage(props: Props) {
|
||||
<BackLink link="/" text="Back to all models" />
|
||||
</motion.div>
|
||||
|
||||
<motion.div className="container-panel pt-4 pb-5" variants={item}>
|
||||
<div className="panel p-3 p-lg-4">
|
||||
<h2 className="fw-bold panel-title">Comments</h2>
|
||||
<div className="py-6">
|
||||
<CommentComponent
|
||||
entityType="user"
|
||||
entityToken={ttsModel.model_token}
|
||||
sessionWrapper={props.sessionWrapper}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</motion.div>
|
||||
|
||||
<motion.div className="container" variants={item}>
|
||||
<h4 className="text-center text-lg-start mb-4">
|
||||
<FontAwesomeIcon icon={faBarsStaggered} className="me-3" />
|
||||
|
||||
@@ -40,6 +40,7 @@ import {
|
||||
import { BackLink } from "../../../_common/BackLink";
|
||||
import { TextExpander } from "../../../_common/TextExpander";
|
||||
import { usePrefixedDocumentTitle } from "../../../../../common/UsePrefixedDocumentTitle";
|
||||
import { CommentComponent } from "../../../_common/comments/CommentComponent";
|
||||
|
||||
interface Props {
|
||||
sessionWrapper: SessionWrapper;
|
||||
@@ -595,10 +596,24 @@ function TtsResultViewPage(props: Props) {
|
||||
<motion.p className="text-center text-lg-start" variants={item}>
|
||||
<ReportDiscordLink />
|
||||
</motion.p>
|
||||
|
||||
<motion.div className="pt-5" variants={item}>
|
||||
<BackLink link="/" text="Back to all models" />
|
||||
</motion.div>
|
||||
</motion.div>
|
||||
|
||||
<motion.div className="container-panel pt-4 pb-5" variants={item}>
|
||||
<div className="panel p-3 p-lg-4">
|
||||
<h2 className="fw-bold panel-title">Comments</h2>
|
||||
<div className="py-6">
|
||||
<CommentComponent
|
||||
entityType="user"
|
||||
entityToken={ttsInferenceResult.tts_result_token}
|
||||
sessionWrapper={props.sessionWrapper}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</motion.div>
|
||||
</motion.div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import { faDownload, faEdit, faTrash } from "@fortawesome/free-solid-svg-icons";
|
||||
import { motion } from "framer-motion";
|
||||
import { container, item, panel } from "../../../../../data/animation";
|
||||
import { usePrefixedDocumentTitle } from "../../../../../common/UsePrefixedDocumentTitle";
|
||||
import { CommentComponent } from "../../../_common/comments/CommentComponent";
|
||||
|
||||
interface Props {
|
||||
sessionWrapper: SessionWrapper;
|
||||
@@ -50,9 +51,10 @@ function W2lResultViewPage(props: Props) {
|
||||
getInferenceResult(token);
|
||||
}, [token, getInferenceResult]); // NB: Empty array dependency sets to run ONLY on mount
|
||||
|
||||
const documentTitle = w2lInferenceResult?.template_title === undefined
|
||||
? undefined
|
||||
: `Deep Fake ${w2lInferenceResult.template_title} Lip Sync Video Result`;
|
||||
const documentTitle =
|
||||
w2lInferenceResult?.template_title === undefined
|
||||
? undefined
|
||||
: `Deep Fake ${w2lInferenceResult.template_title} Lip Sync Video Result`;
|
||||
usePrefixedDocumentTitle(documentTitle);
|
||||
|
||||
if (notFoundState) {
|
||||
@@ -352,6 +354,19 @@ function W2lResultViewPage(props: Props) {
|
||||
<ReportDiscordLink />
|
||||
</motion.div>
|
||||
</motion.div>
|
||||
|
||||
<motion.div className="container-panel pt-4 pb-5" variants={item}>
|
||||
<div className="panel p-3 p-lg-4">
|
||||
<h2 className="fw-bold panel-title">Comments</h2>
|
||||
<div className="py-6">
|
||||
<CommentComponent
|
||||
entityType="user"
|
||||
entityToken={w2lInferenceResult.w2l_result_token}
|
||||
sessionWrapper={props.sessionWrapper}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</motion.div>
|
||||
</motion.div>
|
||||
);
|
||||
}
|
||||
|
||||
+20
-8
@@ -27,6 +27,7 @@ import { motion } from "framer-motion";
|
||||
import { container, item, panel } from "../../../../../data/animation";
|
||||
import { ThirdPartyLinks } from "@storyteller/components/src/constants/ThirdPartyLinks";
|
||||
import { usePrefixedDocumentTitle } from "../../../../../common/UsePrefixedDocumentTitle";
|
||||
import { CommentComponent } from "../../../_common/comments/CommentComponent";
|
||||
|
||||
interface EnqueueJobResponsePayload {
|
||||
success: boolean;
|
||||
@@ -58,7 +59,10 @@ function W2lTemplateViewPage(props: Props) {
|
||||
const [modApprovedFormValue, setModApprovedFormValue] =
|
||||
useState<boolean>(true);
|
||||
|
||||
const documentTitle = w2lTemplate?.title === undefined ? undefined : `Create Deep Fake ${w2lTemplate.title} Lip Sync Video`;
|
||||
const documentTitle =
|
||||
w2lTemplate?.title === undefined
|
||||
? undefined
|
||||
: `Create Deep Fake ${w2lTemplate.title} Lip Sync Video`;
|
||||
usePrefixedDocumentTitle(documentTitle);
|
||||
|
||||
const getTemplate = useCallback(
|
||||
@@ -275,9 +279,7 @@ function W2lTemplateViewPage(props: Props) {
|
||||
let creatorLink = <span />;
|
||||
|
||||
if (!!w2lTemplate?.creator_display_name) {
|
||||
const creatorUrl = WebUrl.userProfilePage(
|
||||
w2lTemplate?.creator_username
|
||||
);
|
||||
const creatorUrl = WebUrl.userProfilePage(w2lTemplate?.creator_username);
|
||||
creatorLink = (
|
||||
<span>
|
||||
<Gravatar
|
||||
@@ -415,10 +417,7 @@ function W2lTemplateViewPage(props: Props) {
|
||||
</motion.h1>
|
||||
<motion.h4 variants={item}>Template: {w2lTemplate?.title}</motion.h4>
|
||||
<motion.div className="pt-3" variants={item}>
|
||||
<BackLink
|
||||
link={WebUrl.w2lListPage()}
|
||||
text="Back to all templates"
|
||||
/>
|
||||
<BackLink link={WebUrl.w2lListPage()} text="Back to all templates" />
|
||||
</motion.div>
|
||||
</div>
|
||||
|
||||
@@ -544,6 +543,19 @@ function W2lTemplateViewPage(props: Props) {
|
||||
</div>
|
||||
</motion.div>
|
||||
|
||||
<motion.div className="container-panel pt-4 pb-5" variants={item}>
|
||||
<div className="panel p-3 p-lg-4">
|
||||
<h2 className="fw-bold panel-title">Comments</h2>
|
||||
<div className="py-6">
|
||||
<CommentComponent
|
||||
entityType="user"
|
||||
entityToken={w2lTemplate.template_token}
|
||||
sessionWrapper={props.sessionWrapper}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</motion.div>
|
||||
|
||||
<SessionW2lInferenceResultList
|
||||
w2lInferenceJobs={props.w2lInferenceJobs}
|
||||
/>
|
||||
|
||||
Reference in new issue
Block a user