mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-09 03:21:23 +00:00
Front page featured defaults
This commit is contained in:
1 parent
176ff7cfb9
commit
a2775f8607
7 files changed
+17
-8
No files matched your search
+3
-1
@@ -1,4 +1,4 @@
|
||||
import { ApiConfig } from "@storyteller/components";
|
||||
import { ApiConfig } from "../ApiConfig";
|
||||
|
||||
interface TtsModelListResponsePayload {
|
||||
success: boolean,
|
||||
@@ -14,6 +14,8 @@ export interface TtsModelListItem {
|
||||
creator_gravatar_hash: string,
|
||||
updatable_slug: string,
|
||||
title: string,
|
||||
is_front_page_featured: boolean,
|
||||
is_twitch_featured: boolean,
|
||||
category_tokens: string[],
|
||||
created_at: string,
|
||||
updated_at: string,
|
||||
@@ -15,7 +15,7 @@ import { W2lInferenceJob, W2lInferenceJobStateResponsePayload } from '@storytell
|
||||
import { TtsModelUploadJob, TtsModelUploadJobStateResponsePayload } from '@storyteller/components/src/jobs/TtsModelUploadJobs';
|
||||
import { W2lTemplateUploadJob, W2lTemplateUploadJobStateResponsePayload } from '@storyteller/components/src/jobs/W2lTemplateUploadJobs';
|
||||
import { jobStateCanChange } from '@storyteller/components/src/jobs/JobStates';
|
||||
import { TtsModelListItem } from './v2/api/tts/ListTtsModels';
|
||||
import { TtsModelListItem } from '@storyteller/components/src/api/tts/ListTtsModels';
|
||||
import { TtsCategoryType } from './AppWrapper';
|
||||
|
||||
enum MigrationMode {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { TtsCategory } from './v2/api/category/ListTtsCategories';
|
||||
import { TtsModelListItem } from './v2/api/tts/ListTtsModels';
|
||||
import { TtsModelListItem } from '@storyteller/components/src/api/tts/ListTtsModels';
|
||||
import { App } from './App';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ import { W2lTemplateEditFc } from './w2l/w2l_template_edit/W2lTemplateEditFc';
|
||||
import { W2lResultDeleteFc } from './w2l/w2l_result_delete/W2lResultDeleteFc';
|
||||
import { W2lTemplateApproveFc } from './w2l/w2l_template_approve/W2lTemplateApproveFc';
|
||||
import { TtsModelListFc } from './tts/tts_model_list/TtsModelListFc';
|
||||
import { TtsModelListItem } from '../api/tts/ListTtsModels';
|
||||
import { TtsModelListItem } from '@storyteller/components/src/api/tts/ListTtsModels';
|
||||
import { ProfileBanFc } from './profile/profile_ban/ProfileBanFc';
|
||||
import { ModerationUserListFc } from './moderation/moderation_user_list/ModerationUserList';
|
||||
import { LeaderboardFc } from './leaderboard/LeaderboardFc';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
import React, { useState } from 'react';
|
||||
import { TtsModelListItem } from '../../../api/tts/ListTtsModels';
|
||||
import { TtsModelListItem } from '@storyteller/components/src/api/tts/ListTtsModels';
|
||||
import { TtsCategoryType } from '../../../../AppWrapper';
|
||||
import Autocomplete from 'react-autocomplete';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { useEffect } from 'react';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import { faChevronRight, faHeadphonesAlt, faTags, faTimes } from '@fortawesome/free-solid-svg-icons';
|
||||
import { TtsModelListItem } from '../../../api/tts/ListTtsModels';
|
||||
import { TtsModelListItem } from '@storyteller/components/src/api/tts/ListTtsModels';
|
||||
import { TtsCategoryType } from '../../../../AppWrapper';
|
||||
|
||||
interface Props {
|
||||
|
||||
@@ -11,7 +11,7 @@ import { TtsModelUploadJob } from '@storyteller/components/src/jobs/TtsModelUplo
|
||||
import { W2lInferenceJob } from '@storyteller/components/src/jobs/W2lInferenceJobs';
|
||||
import { W2lTemplateUploadJob } from '@storyteller/components/src/jobs/W2lTemplateUploadJobs';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { ListTtsModels, TtsModelListItem } from '../../../api/tts/ListTtsModels';
|
||||
import { ListTtsModels, TtsModelListItem } from '@storyteller/components/src/api/tts/ListTtsModels';
|
||||
import { GravatarFc } from '../../_common/GravatarFc';
|
||||
import { VocodesNotice } from './VocodesNotice';
|
||||
import { ListTtsCategories, ListTtsCategoriesIsError, ListTtsCategoriesIsOk } from '../../../api/category/ListTtsCategories';
|
||||
@@ -87,7 +87,14 @@ function TtsModelListFc(props: Props) {
|
||||
dynamicallyCategorizeModels(models);
|
||||
setTtsModels(models);
|
||||
if (!maybeSelectedTtsModel && models.length > 0) {
|
||||
const model = models[0];
|
||||
let model = models[0];
|
||||
const featuredModels = models.filter(m => m.is_front_page_featured);
|
||||
if (featuredModels.length > 0) {
|
||||
// Random featured model
|
||||
model = featuredModels[
|
||||
Math.floor(Math.random()*featuredModels.length)
|
||||
];
|
||||
}
|
||||
setMaybeSelectedTtsModel(model);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user