updates to voice designer

This commit is contained in:
bflatastic committed 2023-10-28 17:17:32 +07:00
1 parent 572f41f80c
commit 7628a442c3
6 files changed
+107 -48

No files matched your search

@@ -5,13 +5,22 @@ interface PanelProps {
padding?: boolean;
mb?: boolean;
mt?: boolean;
className?: string;
}
export default function Panel({ children, padding, mb, mt }: PanelProps) {
export default function Panel({
children,
padding,
mb,
mt,
className,
}: PanelProps) {
return (
<div
className={`panel ${padding ? "p-3 py-4 p-md-4" : ""}
${mb ? "mb-4" : ""} ${mt ? "mt-4" : ""}`}
${mb ? "mb-4" : ""} ${mt ? "mt-4" : ""} overflow-hidden ${
className || ""
}`}
>
{children}
</div>
@@ -178,7 +178,6 @@ export default function MediaPage({ sessionWrapper }: MediaPageProps) {
value: mediaFile.creator_set_visibility.toString(),
},
/*{
property: "Model",
value: mediaFile.model_used,
link: mediaFile.model_link,
},
@@ -54,14 +54,14 @@ function VoiceDesignerCreatePage() {
return (
<Container type="panel">
<PageHeader
title="Creating New Voice"
title="Create New Voice"
titleIcon={faWaveform}
subText="Add voice details and upload audio samples to clone your voice!"
/>
<Panel>
{/* Stepper */}
<div className="p-3 px-lg-4 bg-stepper overflow-hidden">
<div className="p-3 px-lg-4 bg-stepper">
<Stepper steps={steps} currentStep={currentStep} />
</div>
@@ -6,31 +6,43 @@ import PageHeader from "components/layout/PageHeader";
import Container from "components/common/Container";
import { Route, NavLink, Switch, Redirect } from "react-router-dom";
import ListItems from "./components/ListItems/ListItems";
import { Button } from "components/common";
function VoiceDesignerMainPage() {
usePrefixedDocumentTitle("Voice Designer");
const dummyData: any[] = [];
const voicesList = [
{
name: "Donald Trump (45th US President)",
edit: "/tts",
delete: "/",
use: "/",
},
{
name: "Spongebob Squarepants (Season 1)",
edit: "/",
delete: "/",
use: "/",
},
];
const datasetList = [
{ name: "Donald Trump (45th US President)", edit: "/", delete: "/" },
];
const emptyList = [] as any[];
const MyVoices: React.FC = () => {
return <ListItems data={dummyData} />;
};
function MyVoices() {
return <ListItems type="voices" data={voicesList} />;
}
const Datasets: React.FC = () => {
return (
<div>
<h4 className="fw-bold">Datasets</h4>
</div>
);
};
function MyDatasets() {
return <ListItems type="datasets" data={datasetList} />;
}
return (
<Container type="panel">
<PageHeader
title="Voice Designer"
titleIcon={faWaveform}
subText="Turn text into your favorite character's voice."
subText="Create your own AI voice by providing audio files of the voice you want to clone."
showButton={true}
buttonLabel="Create New voice"
buttonVariant="primary"
@@ -44,7 +56,7 @@ function VoiceDesignerMainPage() {
<div className="d-flex flex-grow-1">
<li className="nav-item">
<NavLink
to="/voice-designer/my-voices"
to="/voice-designer/voices"
className="nav-link fs-6 px-3 px-lg-4"
activeClassName="active"
>
@@ -66,13 +78,13 @@ function VoiceDesignerMainPage() {
<div className="p-3 p-lg-4">
<Switch>
<Route path="/voice-designer/voices" exact component={MyVoices} />
<Route
path="/voice-designer/my-voices"
path="/voice-designer/datasets"
exact
component={MyVoices}
component={MyDatasets}
/>
<Route path="/voice-designer/datasets" exact component={Datasets} />
<Redirect to="/voice-designer/my-voices" />
<Redirect to="/voice-designer/voices" />
</Switch>
</div>
</Panel>
@@ -1,17 +1,17 @@
@import "scss/colours.scss";
.list-items {
background-color: lighten($panel, 5%);
background-color: lighten($panel, 4%);
border-radius: 0.5rem;
border: 1px solid lighten($panel, 10%);
border: 1px solid lighten($panel, 8%);
.type-tag {
.dataset-badge {
font-weight: 600;
border-radius: 0.35rem;
font-size: 13px;
padding: 4px 8px;
background-color: $secondary;
color: $white;
padding: 2px 6px;
background-color: #f7daed;
color: #961574;
transition: 0.2s;
-moz-user-select: none;
-khtml-user-select: none;
@@ -19,16 +19,7 @@
-ms-user-select: none;
user-select: none;
height: 100%;
&.public {
color: #494ea9;
background-color: #c6c7e1;
}
&.private {
color: #494ea9;
background-color: #c6c7e1;
}
margin-bottom: 10px;
}
.model-details {
@@ -1,19 +1,42 @@
import React from "react";
import "./ListItems.scss";
import Button from "../../../../../../components/common/Button";
import { faPlus } from "@fortawesome/pro-solid-svg-icons";
import { faMicrophone, faPlus } from "@fortawesome/pro-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
interface ListItemsProps {
data: any[];
type: "voices" | "datasets";
}
export default function ListItems({ data }: ListItemsProps) {
export default function ListItems({ data, type }: ListItemsProps) {
if (data.length === 0) {
return (
<div className="d-flex flex-column list-items p-5 align-items-center">
<h5 className="fw-semibold mb-3">You haven't created any voices.</h5>
<Button icon={faPlus} label="Create New Voice" small={true} to="/" />
{type === "voices" && (
<>
<h5 className="fw-semibold mb-3">
You haven't created any voices.
</h5>
<Button
icon={faPlus}
label="Create New Voice"
small={true}
to="/voice-designer/create"
/>
</>
)}
{type === "datasets" && (
<>
<h5 className="fw-semibold mb-3">No existing datasets yet.</h5>
<Button
icon={faPlus}
label="Create New Voice"
small={true}
to="/voice-designer/create"
/>
</>
)}
</div>
);
}
@@ -32,13 +55,38 @@ export default function ListItems({ data }: ListItemsProps) {
{data.map((item) => {
return (
<div className="d-flex flex-column flex-lg-row gap-3 list-items p-3 align-items-lg-center">
<h5 className="flex-grow-1 fw-semibold mb-0">{item.name}</h5>
<div className="d-inline-flex flex-wrap align-items-center flex-grow-1 gap-2">
{type === "datasets" && (
<span className="dataset-badge mb-0">Dataset</span>
)}
<h5 className="fw-semibold mb-0">
{type === "voices" && (
<FontAwesomeIcon
icon={faMicrophone}
className="me-2 me-lg-3"
/>
)}
{item.name}
</h5>
</div>
<div className="d-flex">
<div className="d-flex gap-2">
<Button label="Edit" small={true} variant="secondary" to="/" />
<Button label="Delete" small={true} variant="danger" to="/" />
<Button label="Use Voice" small={true} to="/" />
<Button
label="Edit"
small={true}
variant="secondary"
to={item.edit}
/>
<Button
label="Delete"
small={true}
variant="danger"
to={item.delete}
/>
{type === "voices" && (
<Button label="Use Voice" small={true} to={item.use} />
)}
</div>
</div>
</div>