PageSourceSearch

https://keepreap.com/assets/StoriesPage-Dr-rc1mz.js

js keepreap.com collected 2026-10-02 01:35:35 UTC 10,699 bytes, 1 lines download raw bytes

1import{iY as B,u as d,j as t,J as f,e7 as $,iZ as z,Q as Y,O as F,i_ as I,r as u,a4 as M,gb as V,B as p,P as C,L as G,ak as K,p as Q,V as U,z as H,E as Z}from"./index.js";import{d as J,e as W}from"./storyApi-BHBWvfNt.js";import{G as h}from"./GenerateStoryButton-B4z9tLBe.js";import{T as q}from"./TopicQueuePanel-Ds9p5oA2.js";import{S as k}from"./StoryCover-BwowLWSK.js";import{u as x}from"./useCanPublishStories-Bs86Sqy4.js";import{T as X}from"./trash-2-C_rdgbuK.js";import{F as ee}from"./FilterChipRow-DkEVdjkS.js";import{a as te}from"./Pagination-DqT_BvTa.js";import{u as se,V as re}from"./useViewMode-VPDQUhdI.js";import"./adminContentApi-BMZEkvfv.js";import"./list-PIEdoAze.js";function ae(e){return B.includes(e)}const ie={news:"stories.topic_news",academic:"stories.topic_academic",business:"stories.topic_business",literature:"stories.topic_literature",exam:"stories.topic_exam",daily:"stories.topic_daily",tech:"stories.topic_tech"};function ne(){const{t:e}=d();return s=>ae(s)?e(ie[s]):s}const le={narrative:"stories.form_narrative",dialogue:"stories.form_dialogue",reference:"stories.form_reference",article:"stories.form_article"};function P({story:e,implied:s}){const{t:r}=d(),a=x();return t.jsxs(t.Fragment,{children:[e.author==="user"&&t.jsx("span",{className:"bg-brand-surface-strong text-brand-text-2 shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium",children:r("stories.author_user")}),e.author==="import"&&t.jsx("span",{className:"bg-brand-surface-strong text-brand-text-2 shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium",children:r("stories.author_import")}),e.form!=="narrative"&&s!=="form"&&t.jsx("span",{className:"bg-brand-surface text-brand-text-2 shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium",children:r(le[e.form])}),a&&s!=="visibility"&&t.jsx("span",{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${e.visibility==="public"?"bg-brand-success-surface text-brand-success":"bg-brand-warning-surface text-brand-warning"}`,children:r(e.visibility==="public"?"stories.scope_published":"stories.scope_unpublished")})]})}function L(e){return e.hasCover?`${$}/stories/${e.id}/cover`:null}function oe({completion:e}){const{t:s}=d(),r=z.filter(a=>e[a]);return r.length===0?null:t.jsxs("p",{className:"text-brand-text-3 mt-1 flex flex-wrap items-center gap-1 text-[11px]",children:[t.jsx("span",{children:s("stories.card_progress")}),r.map(a=>t.jsx("span",{className:"text-brand-success bg-brand-success-surface rounded-full px-1.5 py-0.5 font-medium",children:s(`stories.channel_${a}`)},a))]})}function T({story:e,onDelete:s}){const{t:r}=d(),a=x(),i=r(a?"stories.edit_and_publish":"stories.edit"),n=e.visibility==="public"&&e.slug?Y(e.slug):null;return t.jsxs("div",{className:"relative z-10 flex shrink-0 items-center gap-0.5",children:[n!==null&&t.jsx("a",{href:n,target:"_blank",rel:"noreferrer","aria-label":r("admin.content.preview_open_live"),title:r("admin.content.preview_open_live"),className:"text-brand-text-3 hover:bg-brand-surface hover:text-brand-text-1 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition-colors",children:t.jsx(F,{className:"h-4 w-4"})}),t.jsx(f,{to:`/admin/stories/${e.id}/edit`,"aria-label":i,title:i,className:"text-brand-text-3 hover:bg-brand-surface hover:text-brand-text-1 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition-colors",children:t.jsx(I,{className:"h-4 w-4"})}),t.jsx("button",{type:"button","aria-label":r("common.delete"),onClick:()=>s(e),className:"text-brand-text-3 hover:bg-brand-surface hover:text-brand-danger inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition-colors",children:t.jsx(X,{className:"h-4 w-4"})})]})}function ce({story:e,topicLabel:s,onDelete:r,implied:a}){const{t:i,i18n:n}=d(),c=x();return t.jsx("li",{className:"bg-brand-bg border-brand-border-subtle hover:border-brand-border group relative rounded-xl border transition-colors",children:t.jsxs("div",{className:"flex items-start justify-between gap-2 p-4",children:[t.jsxs(f,{to:`/admin/stories/${e.id}`,className:"flex min-w-0 flex-1 items-start gap-3 after:absolute after:inset-0 after:rounded-xl after:content-['']",children:[t.jsx(k,{title:e.title,src:L(e),className:"h-12 w-[72px] shrink-0"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"text-brand-text-1 flex items-center gap-2 font-medium",children:[t.jsx("span",{className:"truncate",children:e.title}),t.jsx(P,{story:e,implied:a})]}),t.jsxs("p",{className:"text-brand-text-3 mt-1 text-xs",children:[i("stories.card_meta",{words:e.wordCount,reads:e.readCount})," · ",new Date(e.createdAt).toLocaleDateString(n.language),e.to
1pic!==null&&` · ${s(e.topic)}`]}),c?t.jsxs("p",{className:"text-brand-text-3 mt-1 text-xs",children:[e.category??t.jsx("span",{className:"text-brand-warning",children:i("stories.category_missing")}),e.tags.length>0?` · ${e.tags.join(", ")}`:""]}):e.tags.length>0?t.jsx("p",{className:"text-brand-text-3 mt-1 text-xs",children:e.tags.join(", ")}):null,e.partialCoverage&&t.jsx("p",{className:"text-brand-warning mt-1 text-xs",children:i("stories.partial_badge")}),t.jsx(oe,{completion:e.completion})]})]}),t.jsx(T,{story:e,onDelete:r})]})})}function de({story:e,topicLabel:s,onDelete:r,implied:a}){const{t:i,i18n:n}=d(),c=x();return t.jsx("li",{className:"border-brand-border-subtle group relative border-b last:border-b-0",children:t.jsxs("div",{className:"hover:bg-brand-surface-2 flex items-center gap-4 px-4 py-3 transition-colors",children:[t.jsxs(f,{to:`/admin/stories/${e.id}`,className:"flex min-w-0 flex-1 items-center gap-3 after:absolute after:inset-0 after:content-[''] focus-visible:outline-none",children:[t.jsx(k,{title:e.title,src:L(e),className:"h-9 w-[54px] shrink-0"}),t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsxs("span",{className:"text-brand-text-1 flex items-center gap-2 text-[15px] font-medium",children:[t.jsx("span",{className:"truncate",children:e.title}),t.jsx(P,{story:e,implied:a})]}),t.jsxs("span",{className:"text-brand-text-3 mt-0.5 block truncate text-xs",children:[i("stories.card_meta",{words:e.wordCount,reads:e.readCount})," · ",new Date(e.createdAt).toLocaleDateString(n.language),e.topic!==null&&` · ${s(e.topic)}`,c&&" · ",c&&(e.category??t.jsx("span",{className:"text-brand-warning",children:i("stories.category_missing")}))]})]})]}),t.jsx(T,{story:e,onDelete:r})]})})}const ue=["all","unpublished","published","narrative","dialogue","reference","article"],xe=["all","narrative","dialogue"],me={all:"stories.scope_all",unpublished:"stories.scope_unpublished",published:"stories.scope_published",narrative:"stories.form_narrative",dialogue:"stories.form_dialogue",reference:"stories.form_reference",article:"stories.form_article"},pe="keepreap_stories_view",be=25,he={all:"all",unpublished:"private",published:"public",narrative:"narrative",dialogue:"dialogue",reference:"reference",article:"article"};function E(e){if(e!=="all")return e==="unpublished"||e==="published"?"visibility":"form"}function fe(e){return e==="all"?{}:e==="unpublished"?{visibility:"private"}:e==="published"?{visibility:"public"}:{form:e}}function Oe(){var S;const{t:e}=d(),[s,r]=u.useState(null),[a,i]=u.useState("all"),[n,c]=u.useState(0),[g,y]=u.useState(be),[j,O]=se(pe),_=ne(),A=M(),R=x()?ue:xe,{data:o,isLoading:b,isFetching:D,error:v}=J({...fe(a),limit:g,offset:n});u.useEffect(()=>{c(0)},[a]);const m=(o==null?void 0:o.items)??[],N=(o==null?void 0:o.counts)??null,w=(o==null?void 0:o.total)??0;return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("header",{className:"flex flex-wrap items-start justify-between gap-3 sm:gap-4",children:[t.jsxs("div",{className:"min-w-0 space-y-1",children:[t.jsxs("h1",{className:"text-brand-text-1 flex items-center gap-2 text-xl font-semibold tracking-tight sm:text-2xl",children:[t.jsx(V,{className:"h-6 w-6 shrink-0"}),e("stories.title")]}),t.jsx("p",{className:"text-brand-text-2 text-sm",children:e("stories.subtitle")})]}),t.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 sm:shrink-0",children:[t.jsxs(p,{as:"link",to:"/admin/stories/new",variant:"outline",size:"sm",children:[t.jsx(C,{className:"h-4 w-4"}),e("admin.content.create_cta")]}),t.jsx(h,{source:"due",variant:"outline",label:e("stories.generate_due")}),t.jsx(h,{source:"today",variant:"primary",label:e("stories.generate_today")})]})]}),t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx(ee,{ariaLabel:e("stories.scope_filter_label"),selectedId:a,onSelect:i,chips:R.map(l=>({id:l,label:e(me[l]),count:N?N[he[l]]:null}))}),t.jsx(re,{view:j,onChange:O,ariaLabel:e("stories.view_label")})]}),b&&t.jsx(G,{scope:"page"}),v&&!b&&t.jsx("div",{className:"border-brand-danger bg-brand-surface text-brand-danger rounded border p-4 text-sm",children:e("stories.load_error")}),!b&&!D&&!v&&m.length===0&&t.jsxs("div",{className:"bg-brand-bg border-brand-border-subtle text-brand-text-2 roun
1ded-xl border border-dashed p-8 text-center text-sm",children:[t.jsx(K,{className:"text-brand-text-3 mx-auto h-6 w-6"}),t.jsx("p",{className:"text-brand-text-1 mt-2 font-medium",children:e("stories.empty")}),t.jsx("p",{className:"mt-1",children:e("stories.empty_hint")}),t.jsxs("div",{className:"mt-4 flex justify-center gap-2",children:[t.jsxs(p,{as:"link",to:"/admin/stories/new",variant:"outline",size:"sm",children:[t.jsx(C,{className:"h-4 w-4"}),e("admin.content.create_cta")]}),t.jsx(h,{source:"today",variant:"primary",label:e("stories.generate_today")})]})]}),m.length>0&&(j==="cards"?t.jsx("ul",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:m.map(l=>t.jsx(ce,{story:l,topicLabel:_,onDelete:r,implied:E(a)},l.id))}):t.jsx("ul",{className:"border-brand-border-subtle overflow-hidden rounded-2xl border",children:m.map(l=>t.jsx(de,{story:l,topicLabel:_,onDelete:r,implied:E(a)},l.id))})),w>0&&t.jsx(te,{className:"justify-end",total:w,offset:n,pageSize:g,onOffsetChange:c,onPageSizeChange:l=>{y(l),c(0)}}),(S=A.data)!=null&&S.isAdmin?t.jsx(q,{}):null,s&&t.jsx(ge,{target:s,onClose:()=>r(null)})]})}function ge(e){const{t:s}=d(),r=Q(),[a,i]=W();async function n(){if(!i.isLoading)try{await a(e.target.id).unwrap(),e.onClose()}catch{r(H(Z("error","stories.delete_failed")))}}return t.jsx(U,{open:!0,onClose:e.onClose,title:s("stories.delete_title"),footer:t.jsxs(t.Fragment,{children:[t.jsx(p,{variant:"ghost",size:"sm",onClick:e.onClose,children:s("common.cancel")}),t.jsx(p,{variant:"destructive",size:"sm",onClick:n,loading:i.isLoading,children:s("common.delete")})]}),children:t.jsx("p",{className:"text-brand-text-2 text-sm",children:s("stories.delete_confirm")})})}export{Oe 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.