PluginProbe ʕ •ᴥ•ʔ
Author Website Templates – Create Writer, Author & Publisher Websites Easily / 1.1.9
Author Website Templates – Create Writer, Author & Publisher Websites Easily v1.1.9
trunk 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9
author-website-templates / build / blocks / child-author / header / index.js
author-website-templates / build / blocks / child-author / header Last commit date
block.json 1 month ago index.asset.php 1 month ago index.js 1 month ago render.php 1 month ago view.asset.php 1 month ago view.js 1 month ago
index.js
1 lines
1 (()=>{"use strict";var e={n:t=>{var o=t&&t.__esModule?()=>t.default:()=>t;return e.d(o,{a:o}),o},d:(t,o)=>{for(var l in o)e.o(o,l)&&!e.o(t,l)&&Object.defineProperty(t,l,{enumerable:!0,get:o[l]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.blocks,o=window.wp.blockEditor,l=window.wp.components,a=window.wp.i18n,r=window.wp.element,s=window.wp.data,n=window.wp.serverSideRender;var i=e.n(n);const d=window.ReactJSXRuntime,u=({isPro:e,children:t})=>e?t:(0,d.jsxs)("div",{className:"pro-lock-wrapper",style:{position:"relative",cursor:"not-allowed"},children:[(0,d.jsx)("div",{style:{opacity:.4,pointerEvents:"none",filter:"grayscale(100%)"},children:t}),(0,d.jsx)("a",{href:"https://rswpthemes.com/author-portfolio-pro-wordpress-theme/",target:"_blank",rel:"noopener noreferrer",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",zIndex:10,cursor:"pointer"},"aria-label":"Upgrade to Pro",children:(0,d.jsx)(l.Tooltip,{text:"🔒 Pro Feature - Click to Upgrade",children:(0,d.jsx)("div",{style:{width:"100%",height:"100%"}})})})]}),p=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"awt/child-author-header","version":"1.0.0","title":"Header (Child Author)","category":"theme","icon":"menu","description":"Dynamic header with WordPress menu integration, mobile toggle, and Smart Pro Locking for styling controls.","keywords":["header","navigation","menu","child-author"],"textdomain":"author-website-templates","editorScript":"file:./index.js","viewScript":"file:./view.js","render":"file:./render.php","attributes":{"align":{"type":"string","default":"full"},"menuSlug":{"type":"string","default":""},"logoText":{"type":"string","default":"John Doe"},"ctaText":{"type":"string","default":"Latest Book!"},"ctaUrl":{"type":"string","default":"#featured-book"},"navBgColor":{"type":"string","default":""},"linkColor":{"type":"string","default":""},"btnBgColor":{"type":"string","default":""},"blockId":{"type":"string","default":""},"headerStyle":{"type":"string","default":"fun"},"logoType":{"type":"string","default":"custom"},"logoImageId":{"type":"number","default":0},"logoImageUrl":{"type":"string","default":""},"headerBgColor":{"type":"string","default":""},"siteTitleColor":{"type":"string","default":""},"btnTextColor":{"type":"string","default":""},"btnHoverBgColor":{"type":"string","default":""},"btnHoverTextColor":{"type":"string","default":""}},"supports":{"html":false,"align":["full"],"alignWide":true}}');(0,t.registerBlockType)(p.name,{...p,edit:function({attributes:e,setAttributes:t,clientId:n}){const{menuSlug:p,logoText:g,ctaText:h,ctaUrl:c,navBgColor:b,linkColor:m,btnBgColor:w,blockId:x,headerStyle:C,logoType:_,logoImageId:v,logoImageUrl:y,headerBgColor:f,siteTitleColor:j,btnTextColor:T,btnHoverBgColor:S,btnHoverTextColor:k}=e,B=window.awtVars?.isPro||!1;(0,r.useEffect)(()=>{x||t({blockId:n})},[x,n,t]);const{menus:P,isLoadingMenus:L}=(0,s.useSelect)(e=>{const{getEntityRecords:t,isResolving:o}=e("core");return{menus:t("taxonomy","nav_menu",{per_page:-1})||[],isLoadingMenus:o("core","getEntityRecords",["taxonomy","nav_menu",{per_page:-1}])}},[]),I=(0,o.useBlockProps)({className:`alignfull block-${x} awt-child-author-header`}),U=[{label:(0,a.__)("— Select a Menu —","author-website-templates"),value:""},...P?.map(e=>({label:e.name,value:e.slug}))||[]],H={"--awt-header-bg":f||b,"--awt-title-color":j,"--awt-link-color":m,"--awt-btn-bg":w,"--awt-btn-text":T,"--awt-btn-hover-bg":S,"--awt-btn-hover-text":k};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(o.InspectorControls,{children:[(0,d.jsxs)(l.PanelBody,{title:(0,a.__)("Content Settings","author-website-templates"),initialOpen:!0,children:[L?(0,d.jsxs)("div",{style:{padding:"12px",textAlign:"center"},children:[(0,d.jsx)(l.Spinner,{}),(0,d.jsx)("p",{children:(0,a.__)("Loading menus...","author-website-templates")})]}):(0,d.jsx)(l.SelectControl,{label:(0,a.__)("Select Menu","author-website-templates"),value:p,options:U,onChange:e=>t({menuSlug:e}),help:0===P?.length?(0,a.__)("No menus found. Create one in Appearance → Menus","author-website-templates"):(0,a.__)("Choose a WordPress menu to display","author-website-templates")}),(0,d.jsx)("hr",{style:{margin:"16px 0"}}),(0,d.jsx)(l.SelectControl,{label:(0,a.__)("Logo Type","author-website-templates"),value:_,options:[{label:"Site Title",value:"site_title"},{label:"Custom Text",value:"custom"},{label:"Image",value:"image"}],onChange:e=>t({logoType:e})}),"custom"===_&&(0,d.jsx)(l.TextControl,{label:(0,a.__)("Logo Text","author-website-templates"),value:g,onChange:e=>t({logoText:e}),placeholder:"John Doe"}),"site_title"===_&&(0,d.jsx)("p",{className:"description",style:{marginBottom:"16px"},children:(0,a.__)("Displays the global Site Title configured in WordPress Settings.","author-website-templates")}),"image"===_&&(0,d.jsxs)("div",{className:"awt-logo-upload",style:{marginBottom:"16px"},children:[(0,d.jsx)(o.MediaUpload,{onSelect:e=>{t({logoImageId:e.id,logoImageUrl:e.url})},allowedTypes:["image"],value:v,render:({open:e})=>(0,d.jsx)(l.Button,{variant:"secondary",onClick:e,children:v?(0,a.__)("Change Logo","author-website-templates"):(0,a.__)("Upload Logo","author-website-templates")})}),y&&(0,d.jsx)("img",{src:y,alt:"Logo Preview",style:{marginTop:"10px",maxWidth:"150px",height:"auto",display:"block",border:"1px solid #ddd",padding:"4px",borderRadius:"4px",background:"#fff"}})]}),(0,d.jsx)("hr",{style:{margin:"16px 0"}}),(0,d.jsx)("h4",{style:{marginBottom:"12px",fontWeight:"bold"},children:(0,a.__)("CTA Button","author-website-templates")}),(0,d.jsx)(l.TextControl,{label:(0,a.__)("Button Text","author-website-templates"),value:h,onChange:e=>t({ctaText:e}),placeholder:"Latest Book!",help:(0,a.__)("Leave empty to hide button","author-website-templates")}),(0,d.jsx)(l.TextControl,{label:(0,a.__)("Button URL","author-website-templates"),value:c,onChange:e=>t({ctaUrl:e}),placeholder:"#featured-book",help:(0,a.__)("Leave empty to hide button","author-website-templates")})]}),(0,d.jsxs)(l.PanelBody,{title:(0,a.__)("Design Settings","author-website-templates"),initialOpen:!1,children:[(0,d.jsx)(l.SelectControl,{label:(0,a.__)("Layout Style","author-website-templates"),value:e.headerStyle||"fun",options:[{label:"Fun (Default)",value:"fun"},{label:"Elegant (Clean & Serif)",value:"elegant"}],onChange:e=>t({headerStyle:e})}),(0,d.jsx)("hr",{style:{margin:"16px 0"}}),!B&&(0,d.jsx)(l.Notice,{status:"warning",isDismissible:!1,children:(0,a.__)("🔒 Upgrade to Pro to unlock styling controls","author-website-templates")}),(0,d.jsxs)(u,{isPro:B,children:[(0,d.jsx)(o.PanelColorSettings,{title:(0,a.__)("Header Colors","author-website-templates"),colorSettings:[{value:f||b,onChange:B?e=>t({headerBgColor:e}):void 0,label:(0,a.__)("Header Background","author-website-templates"),disableCustomColors:!B},{value:j,onChange:B?e=>t({siteTitleColor:e}):void 0,label:(0,a.__)("Site Title Color","author-website-templates"),disableCustomColors:!B},{value:m,onChange:B?e=>t({linkColor:e}):void 0,label:(0,a.__)("Link Color","author-website-templates"),disableCustomColors:!B}]}),(0,d.jsx)(o.PanelColorSettings,{title:(0,a.__)("Button Colors","author-website-templates"),initialOpen:!1,colorSettings:[{value:w,onChange:B?e=>t({btnBgColor:e}):void 0,label:(0,a.__)("Button Background","author-website-templates"),disableCustomColors:!B},{value:T,onChange:B?e=>t({btnTextColor:e}):void 0,label:(0,a.__)("Button Text Color","author-website-templates"),disableCustomColors:!B},{value:S,onChange:B?e=>t({btnHoverBgColor:e}):void 0,label:(0,a.__)("Button Hover Background","author-website-templates"),disableCustomColors:!B},{value:k,onChange:B?e=>t({btnHoverTextColor:e}):void 0,label:(0,a.__)("Button Hover Text","author-website-templates"),disableCustomColors:!B}]})]})]})]}),(0,d.jsx)("div",{...I,style:H,children:""===p?(0,d.jsx)(l.Placeholder,{icon:"menu",label:(0,a.__)("Header (Child Author)","author-website-templates"),instructions:(0,a.__)("Please select a menu from the sidebar to get started.","author-website-templates")}):(0,d.jsx)(i(),{block:"awt/child-author-header",attributes:e,LoadingResponsePlaceholder:()=>(0,d.jsxs)("div",{style:{padding:"40px",textAlign:"center"},children:[(0,d.jsx)(l.Spinner,{}),(0,d.jsx)("p",{children:(0,a.__)("Loading header preview...","author-website-templates")})]}),ErrorResponsePlaceholder:({response:e})=>(0,d.jsx)(l.Placeholder,{icon:"warning",label:(0,a.__)("Rendering Error","author-website-templates"),children:(0,d.jsx)("p",{children:e?.message||(0,a.__)("Unable to render header preview.","author-website-templates")})})})})]})},save:()=>null})})();