PageSourceSearch

https://snich.ai/assets/SettingsSceneTemplatesPage-8486613e.js

js snich.ai collected 2026-10-05 15:07:53 UTC 5,297 bytes, 1 lines download raw bytes

1import{r as a,j as e}from"./vendor-react-72e4a099.js";import{u as T,d as C,f as E,B as S,F as L,I as A}from"./Toast-43ee7788.js";import{C as h,a as k}from"./Display-48adcc24.js";import{C as B}from"./Controls-5a18fd37.js";import{e as x}from"./api-d8a57490.js";import{p as D}from"./format-5039f022.js";import{SettingsHead as F}from"./SettingsLayout-14516db3.js";import{s as j}from"./sceneTemplates-a017d524.js";import{L as I}from"./layout-template-dfe5c440.js";import{P as R}from"./pencil-line-6bfa5da3.js";import{T as $}from"./trash-2-7a739e24.js";import"./createLucideIcon-581cd729.js";import"./eye-5711d0dd.js";import"./x-b9f3d093.js";import"./circle-check-63b159d4.js";import"./circle-alert-67975319.js";import"./buildLifecycle-a44b0e05.js";import"./chevron-down-888c3b30.js";import"./check-083433f7.js";import"./copy-34f4069e.js";import"./CabinetContext-31fc5321.js";/* empty css               *//* empty css                 */import"./user-2d8f405f.js";import"./video-a08888e9.js";import"./palette-a7aa7952.js";import"./plug-1e9df63e.js";import"./credit-card-a31de76a.js";function M(i){try{return new Date(i).toLocaleDateString("ru-RU",{day:"numeric",month:"long",year:"numeric"})}catch{return""}}function us(){const i=T(),[c,m]=a.useState(null),[f,g]=a.useState(null),[d,t]=a.useState(null),[o,y]=a.useState(""),[v,N]=a.useState(!1),[r,u]=a.useState(null),p=a.useCallback(async()=>{g(null);try{const s=await j.list();m(Array.isArray(s==null?void 0:s.items)?s.items:[])}catch(s){g(x(s,"Не удалось загрузить шаблоны"))}},[]);a.useEffect(()=>{p()},[p]);const b=async()=>{if(!(!d||!o.trim()||v)){N(!0);try{const s=await j.rename(d.id,o.trim());m(n=>(n||[]).map(l=>l.id===s.id?s:l)),t(null),i.success("Шаблон переименован")}catch(s){i.error(x(s,"Не удалось переименовать"))}finally{N(!1)}}},w=async s=>{try{await j.remove(s.id),m(n=>(n||[]).filter(l=>
1l.id!==s.id)),i.success(`Шаблон «${s.name}» удалён`)}catch(n){i.error(x(n,"Не удалось удалить шаблон"))}};return e.jsxs(e.Fragment,{children:[e.jsx(F,{title:"Шаблоны сцен",subtitle:"Папки сцен из студии — чтобы настроить один раз и использовать в других эфирах"}),e.jsxs(h,{className:"sn-a-tpl-how",children:[e.jsx(I,{className:"sn-i","aria-hidden":"true"}),e.jsxs("div",{children:[e.jsx("b",{children:"Как это работает"}),e.jsx("span",{children:"В студии у папки сцен нажмите «…» → «Сохранить как шаблон». В другой студии: «Сцены» → «Шаблоны» → «Добавить» — шаблон придёт отдельной папкой с теми же макетами, формой мест, фоном и графикой. Людей и файлы эфира шаблон не переносит."})]})]}),f?e.jsxs("p",{className:"sn-error",role:"alert",children:[f," ",e.jsx("button",{type:"button",className:"sn-e-linkbtn",onClick:()=>void p(),children:"Повторить"})]}):c===null?e.jsxs("div",{className:"sn-a-tpl-list",children:[e.jsx(k,{height:76}),e.jsx(k,{height:76})]}):c.length===0?e.jsxs(h,{className:"sn-a-tpl-empty",children:[e.jsx("b",{children:"Шаблонов пока нет"}),e.jsx("span",{children:"Сохраните первую папку сцен из студии — она появится здесь."})]}):e.jsx("div",{className:"sn-a-tpl-list","data-testid":"cabinet-scene-templates",children:c.map(s=>e.jsxs(h,{className:"sn-a-tpl","data-template":s.name,children:[e.jsxs("div",{className:"sn-a-tpl-main",children:[e.jsx("b",{children:s.name}),e.jsxs("span",{className:"sn-a-muted",children:[s.sceneCount," ",D(s.sceneCount,"сцена","сцены","сцен")," · папка «",s.folderName,"» · ",s.mine?"вы":s.ownerName||"команда"," · ",M(s.updatedAt)]}),e.jsx("span",{className:"sn-a-tpl-scenes",children:s.scenes.map(n=>e.jsx("span",{className:"sn-a-tpl-chip",children:n.name},n.id))})]}),s.canManage&&e.jsxs("div",{className:"sn-a-tpl-acts",children:[e.jsx(C,{label:`Переименовать «${s.name}»`,size:"sm",onClick:()=>{t(s),y(s.name)},children:e.jsx(R,{className:"sn-i sn-i-16"})}),e.jsx(C,{label:`Удалить «${s.name}»`,size:"sm",onClick:()=>u(s),children:e.jsx($,{className:"sn-i sn-i-16"})})]})]},s.id))}),e.jsx(E,{open:!!d,onClose:()=>t(null),width:440,title:"Переименовать шаблон",footer:e.jsxs(e.Fragment,{children:[e.jsx(S,{variant:"quiet",onClick:()=>t(null),children:"Отмена"}),e.jsx(S,{variant:"primary",loading:v,disabled:!o.trim(),onClick:()=>void b(),children:"Сохранить"})]}),children:e.jsx(L,{label:"Название шаблона",children:e.jsx(A,{value:o,onChange:s=>y(s.target.value.slice(0,60)),onKeyDown:s=>{s.key==="Enter"&&b()},"aria-label":"Название шаблона","data-autofocus":!0})})}),e.jsx(B,{open:!!r,onClose:()=>u(null),onConfirm:()=>{r&&w(r),u(null)},title:r?`Удалить шаблон «${r.name}»?`:"",description:"Сцены, уже добавленные в студии, останутся — пропадёт только шаблон.",confirmLabel:"Удалить шаблон"})]})}export{us 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.