PageSourceSearch

https://clipchat.ai/dist/assets/AdminTrendRanking-BLzQ6Wwl.js

js clipchat.ai collected 2026-10-05 11:57:27 UTC 4,718 bytes, 13 lines download raw bytes

1var e=Object.defineProperty,a=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable,t=(a,n,s)=>n in a?e(a,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[n]=s;import{j as i,U as r,Y as o,B as l,T as d,al as c,a5 as u,a6 as h,ak as m,bH as g,bI as f,bJ as p,bK as x,bL as y,bM as j,bN as b,a4 as v,aH as k,ag as C,aC as R}from"./vendor-mui-CBxi4-UE.js";import{a as S}from"./vendor-react-DJCar8wk.js";import{u as w,a as A,g as T}from"./main-fFbGxLEq.js";import"./index-Cc7IhL_s.js";import"./vendor-utils-hGafao2v.js";const F=["football","dance_repeat","action","pranks","broadcast","octagon","stage","theater_ninja"],L=T`
2  query AdminTrendRanking {
3    trendRanking
4  }
5`,O=T`
6  mutation UpdateTrendRankingConfig($input: UpdateTrendRankingConfigInput!) {
7    updateTrendRankingConfig(input: $input) {
8      success
9      message
10      config
11    }
12  }
13`,I=()=>{const[e,T]=S.useState([]),[I,P]=S.useState([]),[z,E]=S.useState({}),[B,D]=S.useState(7),[N,H]=S.useState(1e3),[U,M]=S.useState(""),[$,_]=S.useState(""),{loading:q,refetch:J}=w(L,{fetchPolicy:"network-only",onCompleted:e=>{(e=>{const a=(null==e?void 0:e.trendRanking)||{},n=Array.isArray(a.counts)?a.counts:[],s=a.config||{};T(n),P(Array.isArray(s.pinnedFamilies)?s.pinnedFamilies:[]),E(s.familyLaunchedAt&&"object"==typeof s.familyLaunchedAt?s.familyLaunchedAt:{}),D(null!=s.boostDays?s.boostDays:7),H(null!=s.boostRank?s.boostRank:1e3)})(e)},onError:e=>{M("Failed to load trend ranking: "+e.message)}}),[K,{loading:W}]=A(O,{onCompleted:e=>{e.updateTrendRankingConfig.success?(_(e.updateTrendRankingConfig.message||"Saved"),J()):M(e.updateTrendRankingConfig.message||"Failed to save trend ranking config")},onError:e=>{M("Failed to save trend ranking config: "+e.message)}}),Y=(()=>{const a=[],n=new Set;return e.forEach(e=>{e&&e.family&&(n.add(e.family),a.push({family:e.family,count:Number(e.count)||0}))}),F.forEach(e=>{n.has(e)||(n.add(e),a.push({family:e,count:0}))}),a})(),G=(e,i)=>{E(r=>{const o=((e,i)=>{for(var r in i||(i={}))n.call(i,r)&&t(e,r,i[r]);if(a)for(var r of a(i))s.call(i,r)&&t(e,r,i[r]);return e})({},r);return i?o[e]=i:delete o[e],o})};return i.jsxs(r,{maxWidth:"lg",sx:{mt:4,mb:4},children:[i.jsxs(o,{elevation:3,sx:{p:4},children:[i.jsxs(l,{sx:{mb:4},children:[i.jsx(d,{variant:"h4",component:"h1",gutterBottom:!0,children:"Trend Ranking"}),i.jsxs(d,{variant:"body1",color:"text.secondary",children:["Pinned families always sort first in «Лучшее сейчас» and their shelf floats to the top. ‘Launched at’ gives a new trend a ",B,"-day decaying boost so it surfaces before it has generation data, then hands off to real counts."]})]}),U&&i.jsx(c,{severity:"error",sx:{mb:3},children:U}),i.jsxs(u,{direction:"row",spacing:2,sx:{mb:3,alignItems:"flex-start"},children:[i.jsx(h,{label:"Boost days",type:"number",value:B,onChange:e=>D(e.target.value),variant:"outlined",size:"small",sx:{width:160}}),i.jsx(h,{label:"Boost rank",type:"number",value:N,onChange:e=>H(e.target.value),variant:"outlined",size:"small",sx:{width:160}})]}),q?i.jsx(l,{sx:{display:"flex",justifyContent:"center",py:10},children:i.jsx(m,{})}):i.jsx(g,{component:o,variant:"outlined",sx:{mb:3},children:i.jsxs(f,{size:"small",children:[i.jsx(p,{children:i.jsxs(x,{children:[i.jsx(y,{children:"Family"}),i.jsx(y,{align:"right",children:"48h generations"}),i.jsx(y,{align:"center",children:"Pinned"}),i.jsx(y,{children:"Launched at"})]})}),i.jsx(j,{children:Y.map(e=>i.jsxs(x,{hover:!0,children:[i.jsx(y,{sx:{fontFamily:"monospace"},children:e.family}),i.jsx(y,{align:"right",children:Math.round(e.count)}),i.jsx(y,{align:"center",children:i.jsx(b,{checked:I.includes(e.family),onChange:()=>{return a=e.family,void P(e=>e.includes(a)?e.filter(e=>e!==a):[...e,a]);var a}})}),i.jsx(y,{children:i.jsx(h,{type:"date",value:z[e.family]||"",onChange:a=>G(e.family,a.target.value),variant:"outlined",size:"small",InputLabelProps:{shrink:!0}})})]},e.family))})]})}),i.jsxs(u,{direction:"row",spacing:2,children:[i.jsx(v,{variant:"contained",color:"primary",startIcon:W?i.jsx(m,{size:18,color:"inherit"}):i.jsx(k,{}),onClick:()=>{M("");const e=Y.map(e=>e.family).filter(e=>I.includes(e)),a={};Object.entries(z).forEach(([e,n])=>{n&&(a[e]=n)}),K({variables:{input:{pinnedFamilies:e,familyLaunchedAt:a,boostDays:Number(B),boostRank:Number(N)}}})},disabled:W||q,children:W?"Saving...":"Save"}),i.jsx(v,{variant:"outlined",startIcon:i.jsx(C,{}),onClick:()=>{J()},disabled:q||W,children:"Reload"})]})]}),i.jsx(R,{open:!!$,autoHideDuration:4e3,onClose:()=>_(""),anchorOrigin:{vertical:"bottom",horizontal:"right"},children:i.jsx(c,{onClose:()=>_(""),severity:"success",children:$})})]})};export{I as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.