PageSourceSearch

https://www.bookbaker.com/assets/ContentReposPage-a244a455.js

js bookbaker.com collected 2026-10-02 21:43:17 UTC 7,989 bytes, 54 lines download raw bytes

1import{g as f,r as o,i as S,j as t,e,F as u,h as s,c as m,s as w,m as A,f as E,I as L}from"./index-c165adff.js";const v={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"FindContentReposQuery"},variableDefinitions:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"contentRepos"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"createdByUser"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]}]}}]}}]}}],loc:{start:0,end:136,source:{body:`
2  query FindContentReposQuery {
3    contentRepos {
4      id
5      name
6      createdByUser {
7        id
8        name
9      }
10    }
11  }
12`,name:"GraphQL request",locationOffset:{line:1,column:1}}}},q={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CreateContentRepoMutation"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"input"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"CreateContentRepoInput"}}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"createContentRepo"},arguments:[{kind:"Argument",name:{kind:"Name",value:"input"},value:{kind:"Variable",name:{kind:"Name",value:"input"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]}]}}]}}],loc:{start:0,end:131,source:{body:`
13  mutation CreateContentRepoMutation($input: CreateContentRepoInput!) {
14    createContentRepo(input: $input) {
15      id
16    }
17  }
18`,name:"GraphQL request",locationOffset:{line:1,column:1}}}},O={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"DeleteContentRepoMutation"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"deleteContentRepo"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]}]}}]}}],loc:{start:0,end:106,source:{body:`
19  mutation DeleteContentRepoMutation($id: String!) {
20    deleteContentRepo(id: $id) {
21      id
22    }
23  }
24`,name:"GraphQL request",locationOffset:{line:1,column:1}}}},I={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"QueryTextbookConfigsForTryingRepo"},variableDefinitions:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"textbookConfigs"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"publishedAt"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"updatedAt"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"createdByUser"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]}]}}]}}]}}],loc:{start:0,end:174,source:{body:`
25  query QueryTextbookConfigsForTryingRepo {
26    textbookConfigs {
27      id
28      name
29      publishedAt
30      updatedAt
31      createdByUser {
32        name
33      }
34    }
35  }
36`,name:"GraphQL request",locationOffset:{line:1,column:1}}}},M=({publishedAt:r,updatedAt:p})=>!!r||new Date(p).getTime()+30*24*60*60*1e3>Date.now(),$=()=>{const{data:r,loading:p}=f(v),[c,k]=o.useState(null),{data:l,loading:R}=f(I,{skip:!c}
36),[g,F]=o.useState(!1),[d,h]=o.useState("");o.useEffect(()=>{var n;if(!d){const i=(n=l==null?void 0:l.textbookConfigs)==null?void 0:n.find(a=>!!a.publishedAt);i&&h(i.id)}},[d,h,l]);const y=(r==null?void 0:r.contentRepos)??[],[D,{loading:C}]=S(q,{refetchQueries:[{query:v}]}),[x,{loading:T}]=S(O,{refetchQueries:[{query:v}]}),[b,N]=o.useState("");return t(u,{children:[e(E.Metadata,{title:"Content Repos",description:"Content Repos page"}),e("h1",{children:"Content Repos"}),c?t(u,{children:[t("p",{children:["Select a textbook config to try with “",c.name,"”:"]}),t("p",{children:[e("a",{className:"btn btn-primary",target:"_blank",href:s.routes.createTextbook({langCode:"en",config:d,folder:c.id}),rel:"noreferrer",onClick:()=>{k(null)},children:"Try With Selected Config"})," ",e("button",{type:"button",className:"btn btn-secondary",onClick:()=>{k(null)},children:"Back"})]}),R?e("p",{children:"Loading..."}):t(u,{children:[t("table",{className:"table-data",css:m`
37                  td {
38                    cursor: default;
39                    user-select: none;
40                  }
41
42                  tr.selected > td {
43                    background-color: ${w.blue(10)} !important;
44                  }
45                `,children:[e("thead",{children:t("tr",{children:[e("th",{}),e("th",{children:"#"}),e("th",{children:"Name"}),e("th",{children:"Created By"})]})}),e("tbody",{children:l.textbookConfigs.map(n=>{if(d!==n.id&&!M(n)&&!g)return e(o.Fragment,{},n.id);const i=a=>{a.stopPropagation(),h(n.id)};return t("tr",{onClick:i,className:d===n.id?"selected":void 0,children:[e("td",{children:e("input",{type:"radio",checked:d===n.id,onClick:i})}),t("td",{css:m`
46                            white-space: nowrap;
47                          `,children:[e("code",{children:n.id.substr(-6)}),n.publishedAt&&" ✅"]}),e("td",{children:n.name}),e("td",{children:n.createdByUser.name})]},n.id)})})]}),e("button",{type:"button",className:"btn btn-secondary",onClick:()=>{F(n=>!n)},children:g?"Hide Old":"Show All"})]})]}):t(u,{children:[p&&e("p",{children:"Loading..."}),t("table",{className:"table-data",children:[e("thead",{children:t("tr",{children:[e("th",{children:"#"}),e("th",{children:"Name"}),e("th",{children:"Created By"}),e("th",{children:"Actions"})]})}),t("tbody",{children:[y.length<=0&&e("tr",{children:e("td",{colSpan:4,children:e("p",{css:m`
48                        margin: 3rem;
49                        text-align: center;
50                      `,children:"No results"})})}),y.map(({id:n,name:i,createdByUser:a})=>t("tr",{children:[e("td",{children:e("code",{children:e(s.Link,{to:s.routes.contentModContentRepoDocuments({id:n}),children:n.substr(-6)})})}),e("td",{children:e(s.Link,{to:s.routes.contentModContentRepoDocuments({id:n}),children:i})}),e("td",{children:(a==null?void 0:a.name)??e("em",{children:"Unknown"})}),t("td",{children:[e("button",{type:"button",className:"btn btn-secondary",onClick:()=>{k({id:n,name:i})},children:"Try"})," ",e("button",{type:"button",className:"btn btn-secondary",disabled:T,onClick:async()=>{if(confirm(`Delete "${i}"?`))try{await x({variables:{id:n}})}catch(Q){console.error(Q),alert("Error: Failed to delete. Is it empty?")}},children:"Delete"})]})]},n))]})]}),t(A,{onSubmit:async()=>{await D({variables:{input:{name:b.trim()}}}),N("")},children:[e("h2",{children:"Create Content Repo"}),t("div",{css:m`
51                display: flex;
52                flex-flow: row nowrap;
53                gap: 10px;
54              `,children:[e(L,{placeholder:"Name",value:b,onInput:N,disabled:C}),e("button",{type:"submit",className:"btn btn-primary",disabled:!b.trim()||C,children:"Submit"})]})]})]})]})};export{$ 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.