From 73a70d949c934d4c8dab7fd11b933067b33e24e2 Mon Sep 17 00:00:00 2001 From: VividTruthKeeper Date: Sun, 5 Mar 2023 21:52:42 +0500 Subject: [PATCH] category name bug fix --- .../{index-20511609.js => index-42dcf52a.js} | 2 +- dist/index.html | 2 +- src/components/aside/Aside.tsx | 2 +- src/types/posts.types.ts | 42 +++++++++++++++++++ 4 files changed, 45 insertions(+), 3 deletions(-) rename dist/assets/{index-20511609.js => index-42dcf52a.js} (99%) create mode 100644 src/types/posts.types.ts diff --git a/dist/assets/index-20511609.js b/dist/assets/index-42dcf52a.js similarity index 99% rename from dist/assets/index-20511609.js rename to dist/assets/index-42dcf52a.js index 545d881..ba8deae 100644 --- a/dist/assets/index-20511609.js +++ b/dist/assets/index-42dcf52a.js @@ -112,7 +112,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho @keyframes `.concat(r,` { `).concat(t,` } - `);return o&&o.insertRule(a,0),r},Wl=globalThis&&globalThis.__assign||function(){return Wl=Object.assign||function(e){for(var t,n=1,r=arguments.length;nL("div",{className:"loader",children:L(i4,{color:"#38a39d",loading:!0,cssOverride:{display:"block",margin:"10 auto",borderColor:"red",height:"100%"},"aria-label":"loader","data-testid":"loader"})}),Ym=({type:e})=>{const t=new Tn(Tr+`${e==="popular"?"/popular":""}/posts`,V9),[n,r]=A.useState();return A.useEffect(()=>{t.get(n,r)},[]),ee("div",{className:"aside",children:[ee("div",{className:"aside-wrapper",children:[L(Xu,{title:e==="latest"?"Последние новости":"Самое читаемое"}),L("div",{className:"aside-inner",children:e==="popular"?n?n.data.map(i=>L(zg,{title:i.title,date:i.published_at,category:i.categories[0].name,img:i.featured_images[0]?i.featured_images[0].path:"",id:i.id},at())):L(Bn,{}):n?n.map(i=>L(zg,{title:i.title,date:i.published_at,category:i.categories[0].name,img:i.featured_images[0]?i.featured_images[0].path:"",id:i.id},at())):L(Bn,{})})]}),L("div",{className:"aside-calendar",children:L(Z3,{})})]})},Mp=({id:e,title:t,text:n,categories:r,date:i,img:o})=>L(Ce,{to:`/news/${e}`,children:ee("div",{className:"news-wrapper",children:[L("div",{className:"news-image",children:L(En.LazyLoadImage,{src:o,alt:o,useIntersectionObserver:!0,effect:"opacity",placeholderSrc:qa})}),L("div",{className:"news-info",children:ee("div",{className:"news-info-inner",children:[L("h2",{className:"news-title",children:t}),ee("div",{className:"news-status",children:[L("div",{className:"news-status-left",children:r.map(a=>L(TP,{title:a.name},at()))}),L("div",{className:"news-status-right",children:L(CP,{date:i})})]}),L("div",{className:"news-text",dangerouslySetInnerHTML:{__html:n}})]})})]})}),O0=e=>({type:"SET_NEWS_SCROLL",payload:e}),_0=e=>({type:"SET_SEARCH_DATA",payload:e}),o4=e=>({type:"SET_POST",payload:e}),a4=e=>({type:"SET_VIDEO",payload:e}),s4=e=>({type:"SET_FEATURED",payload:e}),TO=({title:e,category:t,count:n,avoidFirst:r})=>{const i=j9.slice();t&&i.push({name:"category",value:t}),n&&(i[0].value=n);const o=new Tn(Tr+"/posts",i),a=o.language,[s,l]=A.useState(a),u=cn(v=>v.newsScroll.data),c=Cr();A.useEffect(()=>{o.get(u,v=>c(O0(v))),l(a)},[t]),A.useEffect(()=>{u.length>0&&(u[0].id>-1&&s===a||(o.get(u,v=>c(O0(v))),l(a)))},[a,s]);const[d,m]=A.useState(u);return A.useEffect(()=>{const v=u.filter((b,O)=>{if(O>=0)return b});m(v)},[u]),L("div",{className:"news-scroll",children:ee("div",{className:"news-scroll-wrapper",children:[e===!0?L(Xu,{title:"Лента новостей",linkData:{link:"/all",title:"Посмотреть все"}}):null,L("div",{className:"news-scroll-inner",children:d.length>0?d[0].id>-1?d.map((v,b)=>{if(r){if(b>0)return L(Mp,{id:v.id,title:v.title,text:v.excerpt,date:v.published_at,categories:v.categories,img:v.featured_images[0]?v.featured_images[0].path:""},at())}else return L(Mp,{id:v.id,title:v.title,text:v.excerpt,date:v.published_at,categories:v.categories,img:v.featured_images[0]?v.featured_images[0].path:""},at())}):L(Bn,{}):L("p",{className:"scroll-empty",children:"Нет новостей в этой категории"})})]})})};var CO={},xO={},ve={},l4=function(t,n,r){var i=document.head||document.getElementsByTagName("head")[0],o=document.createElement("script");typeof n=="function"&&(r=n,n={}),n=n||{},r=r||function(){},o.type=n.type||"text/javascript",o.charset=n.charset||"utf8",o.async="async"in n?!!n.async:!0,o.src=t,n.attrs&&u4(o,n.attrs),n.text&&(o.text=""+n.text);var a="onload"in o?E0:c4;a(o,r),o.onload||E0(o,r),i.appendChild(o)};function u4(e,t){for(var n in t)e.setAttribute(n,t[n])}function E0(e,t){e.onload=function(){this.onerror=this.onload=null,t(null,e)},e.onerror=function(){this.onerror=this.onload=null,t(new Error("Failed to load "+this.src),e)}}function c4(e,t){e.onreadystatechange=function(){this.readyState!="complete"&&this.readyState!="loaded"||(this.onreadystatechange=null,t(null,e))}}var f4=function(t){return d4(t)&&!p4(t)};function d4(e){return!!e&&typeof e=="object"}function p4(e){var t=Object.prototype.toString.call(e);return t==="[object RegExp]"||t==="[object Date]"||y4(e)}var h4=typeof Symbol=="function"&&Symbol.for,m4=h4?Symbol.for("react.element"):60103;function y4(e){return e.$$typeof===m4}function v4(e){return Array.isArray(e)?[]:{}}function La(e,t){return t.clone!==!1&&t.isMergeableObject(e)?ao(v4(e),e,t):e}function g4(e,t,n){return e.concat(t).map(function(r){return La(r,n)})}function w4(e,t){if(!t.customMerge)return ao;var n=t.customMerge(e);return typeof n=="function"?n:ao}function b4(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return e.propertyIsEnumerable(t)}):[]}function T0(e){return Object.keys(e).concat(b4(e))}function DO(e,t){try{return t in e}catch{return!1}}function S4(e,t){return DO(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}function P4(e,t,n){var r={};return n.isMergeableObject(e)&&T0(e).forEach(function(i){r[i]=La(e[i],n)}),T0(t).forEach(function(i){S4(e,i)||(DO(e,i)&&n.isMergeableObject(t[i])?r[i]=w4(i,n)(e[i],t[i],n):r[i]=La(t[i],n))}),r}function ao(e,t,n){n=n||{},n.arrayMerge=n.arrayMerge||g4,n.isMergeableObject=n.isMergeableObject||f4,n.cloneUnlessOtherwiseSpecified=La;var r=Array.isArray(t),i=Array.isArray(e),o=r===i;return o?r?n.arrayMerge(e,t,n):P4(e,t,n):La(t,n)}ao.all=function(t,n){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(r,i){return ao(r,i,n)},{})};var O4=ao,kO=O4;Object.defineProperty(ve,"__esModule",{value:!0});ve.parseStartTime=N4;ve.parseEndTime=I4;ve.randomString=j4;ve.queryString=V4;ve.getSDK=$4;ve.getConfig=F4;ve.omit=B4;ve.callPlayer=z4;ve.isMediaStream=U4;ve.isBlobUrl=W4;ve.supportsWebKitPresentationMode=H4;var _4=RO(l4),E4=RO(kO);function RO(e){return e&&e.__esModule?e:{default:e}}function T4(e,t){return k4(e)||D4(e,t)||x4(e,t)||C4()}function C4(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. + `);return o&&o.insertRule(a,0),r},Wl=globalThis&&globalThis.__assign||function(){return Wl=Object.assign||function(e){for(var t,n=1,r=arguments.length;nL("div",{className:"loader",children:L(i4,{color:"#38a39d",loading:!0,cssOverride:{display:"block",margin:"10 auto",borderColor:"red",height:"100%"},"aria-label":"loader","data-testid":"loader"})}),Ym=({type:e})=>{const t=new Tn(Tr+`${e==="popular"?"/popular":""}/posts`,V9),[n,r]=A.useState();return A.useEffect(()=>{t.get(n,r)},[]),ee("div",{className:"aside",children:[ee("div",{className:"aside-wrapper",children:[L(Xu,{title:e==="latest"?"Последние новости":"Самое читаемое"}),L("div",{className:"aside-inner",children:e==="popular"?n?n.data.map(i=>L(zg,{title:i.title,date:i.published_at,category:i.categories[0]?i.categories[0].name:"",img:i.featured_images[0]?i.featured_images[0].path:"",id:i.id},at())):L(Bn,{}):n?n.map(i=>L(zg,{title:i.title,date:i.published_at,category:i.categories[0].name,img:i.featured_images[0]?i.featured_images[0].path:"",id:i.id},at())):L(Bn,{})})]}),L("div",{className:"aside-calendar",children:L(Z3,{})})]})},Mp=({id:e,title:t,text:n,categories:r,date:i,img:o})=>L(Ce,{to:`/news/${e}`,children:ee("div",{className:"news-wrapper",children:[L("div",{className:"news-image",children:L(En.LazyLoadImage,{src:o,alt:o,useIntersectionObserver:!0,effect:"opacity",placeholderSrc:qa})}),L("div",{className:"news-info",children:ee("div",{className:"news-info-inner",children:[L("h2",{className:"news-title",children:t}),ee("div",{className:"news-status",children:[L("div",{className:"news-status-left",children:r.map(a=>L(TP,{title:a.name},at()))}),L("div",{className:"news-status-right",children:L(CP,{date:i})})]}),L("div",{className:"news-text",dangerouslySetInnerHTML:{__html:n}})]})})]})}),O0=e=>({type:"SET_NEWS_SCROLL",payload:e}),_0=e=>({type:"SET_SEARCH_DATA",payload:e}),o4=e=>({type:"SET_POST",payload:e}),a4=e=>({type:"SET_VIDEO",payload:e}),s4=e=>({type:"SET_FEATURED",payload:e}),TO=({title:e,category:t,count:n,avoidFirst:r})=>{const i=j9.slice();t&&i.push({name:"category",value:t}),n&&(i[0].value=n);const o=new Tn(Tr+"/posts",i),a=o.language,[s,l]=A.useState(a),u=cn(v=>v.newsScroll.data),c=Cr();A.useEffect(()=>{o.get(u,v=>c(O0(v))),l(a)},[t]),A.useEffect(()=>{u.length>0&&(u[0].id>-1&&s===a||(o.get(u,v=>c(O0(v))),l(a)))},[a,s]);const[d,m]=A.useState(u);return A.useEffect(()=>{const v=u.filter((b,O)=>{if(O>=0)return b});m(v)},[u]),L("div",{className:"news-scroll",children:ee("div",{className:"news-scroll-wrapper",children:[e===!0?L(Xu,{title:"Лента новостей",linkData:{link:"/all",title:"Посмотреть все"}}):null,L("div",{className:"news-scroll-inner",children:d.length>0?d[0].id>-1?d.map((v,b)=>{if(r){if(b>0)return L(Mp,{id:v.id,title:v.title,text:v.excerpt,date:v.published_at,categories:v.categories,img:v.featured_images[0]?v.featured_images[0].path:""},at())}else return L(Mp,{id:v.id,title:v.title,text:v.excerpt,date:v.published_at,categories:v.categories,img:v.featured_images[0]?v.featured_images[0].path:""},at())}):L(Bn,{}):L("p",{className:"scroll-empty",children:"Нет новостей в этой категории"})})]})})};var CO={},xO={},ve={},l4=function(t,n,r){var i=document.head||document.getElementsByTagName("head")[0],o=document.createElement("script");typeof n=="function"&&(r=n,n={}),n=n||{},r=r||function(){},o.type=n.type||"text/javascript",o.charset=n.charset||"utf8",o.async="async"in n?!!n.async:!0,o.src=t,n.attrs&&u4(o,n.attrs),n.text&&(o.text=""+n.text);var a="onload"in o?E0:c4;a(o,r),o.onload||E0(o,r),i.appendChild(o)};function u4(e,t){for(var n in t)e.setAttribute(n,t[n])}function E0(e,t){e.onload=function(){this.onerror=this.onload=null,t(null,e)},e.onerror=function(){this.onerror=this.onload=null,t(new Error("Failed to load "+this.src),e)}}function c4(e,t){e.onreadystatechange=function(){this.readyState!="complete"&&this.readyState!="loaded"||(this.onreadystatechange=null,t(null,e))}}var f4=function(t){return d4(t)&&!p4(t)};function d4(e){return!!e&&typeof e=="object"}function p4(e){var t=Object.prototype.toString.call(e);return t==="[object RegExp]"||t==="[object Date]"||y4(e)}var h4=typeof Symbol=="function"&&Symbol.for,m4=h4?Symbol.for("react.element"):60103;function y4(e){return e.$$typeof===m4}function v4(e){return Array.isArray(e)?[]:{}}function La(e,t){return t.clone!==!1&&t.isMergeableObject(e)?ao(v4(e),e,t):e}function g4(e,t,n){return e.concat(t).map(function(r){return La(r,n)})}function w4(e,t){if(!t.customMerge)return ao;var n=t.customMerge(e);return typeof n=="function"?n:ao}function b4(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return e.propertyIsEnumerable(t)}):[]}function T0(e){return Object.keys(e).concat(b4(e))}function DO(e,t){try{return t in e}catch{return!1}}function S4(e,t){return DO(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}function P4(e,t,n){var r={};return n.isMergeableObject(e)&&T0(e).forEach(function(i){r[i]=La(e[i],n)}),T0(t).forEach(function(i){S4(e,i)||(DO(e,i)&&n.isMergeableObject(t[i])?r[i]=w4(i,n)(e[i],t[i],n):r[i]=La(t[i],n))}),r}function ao(e,t,n){n=n||{},n.arrayMerge=n.arrayMerge||g4,n.isMergeableObject=n.isMergeableObject||f4,n.cloneUnlessOtherwiseSpecified=La;var r=Array.isArray(t),i=Array.isArray(e),o=r===i;return o?r?n.arrayMerge(e,t,n):P4(e,t,n):La(t,n)}ao.all=function(t,n){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(r,i){return ao(r,i,n)},{})};var O4=ao,kO=O4;Object.defineProperty(ve,"__esModule",{value:!0});ve.parseStartTime=N4;ve.parseEndTime=I4;ve.randomString=j4;ve.queryString=V4;ve.getSDK=$4;ve.getConfig=F4;ve.omit=B4;ve.callPlayer=z4;ve.isMediaStream=U4;ve.isBlobUrl=W4;ve.supportsWebKitPresentationMode=H4;var _4=RO(l4),E4=RO(kO);function RO(e){return e&&e.__esModule?e:{default:e}}function T4(e,t){return k4(e)||D4(e,t)||x4(e,t)||C4()}function C4(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function x4(e,t){if(e){if(typeof e=="string")return C0(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return C0(e,t)}}function C0(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n"u"||!(Symbol.iterator in Object(e)))){var n=[],r=!0,i=!1,o=void 0;try{for(var a=e[Symbol.iterator](),s;!(r=(s=a.next()).done)&&(n.push(s.value),!(t&&n.length===t));r=!0);}catch(l){i=!0,o=l}finally{try{!r&&a.return!=null&&a.return()}finally{if(i)throw o}}return n}}function k4(e){if(Array.isArray(e))return e}var R4=/[?&#](?:start|t)=([0-9hms]+)/,L4=/[?&#]end=([0-9hms]+)/,Np=/(\d+)(h|m|s)/g,A4=/^\d+$/;function LO(e,t){if(!(e instanceof Array)){var n=e.match(t);if(n){var r=n[1];if(r.match(Np))return M4(r);if(A4.test(r))return parseInt(r)}}}function M4(e){for(var t=0,n=Np.exec(e);n!==null;){var r=n,i=T4(r,3),o=i[1],a=i[2];a==="h"&&(t+=parseInt(o,10)*60*60),a==="m"&&(t+=parseInt(o,10)*60),a==="s"&&(t+=parseInt(o,10)),n=Np.exec(e)}return t}function N4(e){return LO(e,R4)}function I4(e){return LO(e,L4)}function j4(){return Math.random().toString(36).substr(2,5)}function V4(e){return Object.keys(e).map(function(t){return"".concat(t,"=").concat(e[t])}).join("&")}function ff(e){return window[e]?window[e]:window.exports&&window.exports[e]?window.exports[e]:window.module&&window.module.exports&&window.module.exports[e]?window.module.exports[e]:null}var yi={};function $4(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:function(){return!0},i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:_4.default,o=ff(t);return o&&r(o)?Promise.resolve(o):new Promise(function(a,s){if(yi[e]){yi[e].push({resolve:a,reject:s});return}yi[e]=[{resolve:a,reject:s}];var l=function(d){yi[e].forEach(function(m){return m.resolve(d)})};if(n){var u=window[n];window[n]=function(){u&&u(),l(ff(t))}}i(e,function(c){c?(yi[e].forEach(function(d){return d.reject(c)}),yi[e]=null):n||l(ff(t))})})}function F4(e,t){return(0,E4.default)(t.config,e.config)}function B4(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i1?r-1:0),o=1;o0&&arguments[0]!==void 0?arguments[0]:document.createElement("video"),t=/iPhone|iPod/.test(navigator.userAgent)===!1;return e.webkitSupportsPresentationMode&&typeof e.webkitSetPresentationMode=="function"&&t}var ie={};Object.defineProperty(ie,"__esModule",{value:!0});ie.canPlay=ie.FLV_EXTENSIONS=ie.DASH_EXTENSIONS=ie.HLS_EXTENSIONS=ie.VIDEO_EXTENSIONS=ie.AUDIO_EXTENSIONS=ie.MATCH_URL_KALTURA=ie.MATCH_URL_VIDYARD=ie.MATCH_URL_MIXCLOUD=ie.MATCH_URL_DAILYMOTION=ie.MATCH_URL_TWITCH_CHANNEL=ie.MATCH_URL_TWITCH_VIDEO=ie.MATCH_URL_WISTIA=ie.MATCH_URL_STREAMABLE=ie.MATCH_URL_FACEBOOK_WATCH=ie.MATCH_URL_FACEBOOK=ie.MATCH_URL_VIMEO=ie.MATCH_URL_SOUNDCLOUD=ie.MATCH_URL_YOUTUBE=void 0;var x0=ve;function G4(e,t){var n;if(typeof Symbol>"u"||e[Symbol.iterator]==null){if(Array.isArray(e)||(n=Y4(e))||t&&e&&typeof e.length=="number"){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,s;return{s:function(){n=e[Symbol.iterator]()},n:function(){var u=n.next();return o=u.done,u},e:function(u){a=!0,s=u},f:function(){try{!o&&n.return!=null&&n.return()}finally{if(a)throw s}}}}function Y4(e,t){if(e){if(typeof e=="string")return D0(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return D0(e,t)}}function D0(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);nR.length)&&(D=R.length);for(var M=0,V=new Array(D);M"u"||!(Symbol.iterator in Object(R)))){var M=[],V=!0,z=!1,G=void 0;try{for(var Z=R[Symbol.iterator](),re;!(V=(re=Z.next()).done)&&(M.push(re.value),!(D&&M.length===D));V=!0);}catch(se){z=!0,G=se}finally{try{!V&&Z.return!=null&&Z.return()}finally{if(z)throw G}}return M}}function b(R){if(Array.isArray(R))return R}function O(R,D){if(!(R instanceof D))throw new TypeError("Cannot call a class as a function")}function T(R,D){for(var M=0;M"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function f(R){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(M){return M.__proto__||Object.getPrototypeOf(M)},f(R)}function y(R,D,M){return D in R?Object.defineProperty(R,D,{value:M,enumerable:!0,configurable:!0,writable:!0}):R[D]=M,R}var p="https://www.youtube.com/iframe_api",P="YT",C="onYouTubeIframeAPIReady",N=/[?&](?:list|channel)=([a-zA-Z0-9_-]+)/,k=/user\/([a-zA-Z0-9_-]+)\/?/,$=/youtube-nocookie\.com/,I="https://www.youtube-nocookie.com",j=function(R){g(M,R);var D=x(M);function M(){var V;O(this,M);for(var z=arguments.length,G=new Array(z),Z=0;Z"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function g(w){return g=Object.setPrototypeOf?Object.getPrototypeOf:function(y){return y.__proto__||Object.getPrototypeOf(y)},g(w)}function S(w,f,y){return f in w?Object.defineProperty(w,f,{value:y,enumerable:!0,configurable:!0,writable:!0}):w[f]=y,w}var x="https://w.soundcloud.com/player/api.js",_="SC",E=function(w){m(y,w);var f=b(y);function y(){var p;u(this,y);for(var P=arguments.length,C=new Array(P),N=0;N"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function g(w){return g=Object.setPrototypeOf?Object.getPrototypeOf:function(y){return y.__proto__||Object.getPrototypeOf(y)},g(w)}function S(w,f,y){return f in w?Object.defineProperty(w,f,{value:y,enumerable:!0,configurable:!0,writable:!0}):w[f]=y,w}var x="https://player.vimeo.com/api/player.js",_="Vimeo",E=function(w){m(y,w);var f=b(y);function y(){var p;u(this,y);for(var P=arguments.length,C=new Array(P),N=0;N"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function h(f){return h=Object.setPrototypeOf?Object.getPrototypeOf:function(p){return p.__proto__||Object.getPrototypeOf(p)},h(f)}function g(f,y,p){return y in f?Object.defineProperty(f,y,{value:p,enumerable:!0,configurable:!0,writable:!0}):f[y]=p,f}var S="https://connect.facebook.net/en_US/sdk.js",x="FB",_="fbAsyncInit",E="facebook-player-",w=function(f){d(p,f);var y=v(p);function p(){var P;l(this,p);for(var C=arguments.length,N=new Array(C),k=0;k"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function T(_){return T=Object.setPrototypeOf?Object.getPrototypeOf:function(w){return w.__proto__||Object.getPrototypeOf(w)},T(_)}function h(_,E,w){return E in _?Object.defineProperty(_,E,{value:w,enumerable:!0,configurable:!0,writable:!0}):_[E]=w,_}var g="https://cdn.embed.ly/player-0.1.0.min.js",S="playerjs",x=function(_){c(w,_);var E=m(w);function w(){var f;s(this,w);for(var y=arguments.length,p=new Array(y),P=0;P"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function g(f){return g=Object.setPrototypeOf?Object.getPrototypeOf:function(p){return p.__proto__||Object.getPrototypeOf(p)},g(f)}function S(f,y,p){return y in f?Object.defineProperty(f,y,{value:p,enumerable:!0,configurable:!0,writable:!0}):f[y]=p,f}var x="https://fast.wistia.com/assets/external/E-v1.js",_="Wistia",E="wistia-player-",w=function(f){m(p,f);var y=b(p);function p(){var P;u(this,p);for(var C=arguments.length,N=new Array(C),k=0;k"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function g(f){return g=Object.setPrototypeOf?Object.getPrototypeOf:function(p){return p.__proto__||Object.getPrototypeOf(p)},g(f)}function S(f,y,p){return y in f?Object.defineProperty(f,y,{value:p,enumerable:!0,configurable:!0,writable:!0}):f[y]=p,f}var x="https://player.twitch.tv/js/embed/v1.js",_="Twitch",E="twitch-player-",w=function(f){m(p,f);var y=b(p);function p(){var P;u(this,p);for(var C=arguments.length,N=new Array(C),k=0;k Türkmenistan Habarlar Portaly - + diff --git a/src/components/aside/Aside.tsx b/src/components/aside/Aside.tsx index d231c9c..968db89 100644 --- a/src/components/aside/Aside.tsx +++ b/src/components/aside/Aside.tsx @@ -47,7 +47,7 @@ const Aside = ({ type }: Props) => { key={uuidv4()} title={el.title} date={el.published_at} - category={el.categories[0].name} + category={el.categories[0] ? el.categories[0].name : ""} img={ el.featured_images[0] ? el.featured_images[0].path : "" } diff --git a/src/types/posts.types.ts b/src/types/posts.types.ts new file mode 100644 index 0000000..fecf474 --- /dev/null +++ b/src/types/posts.types.ts @@ -0,0 +1,42 @@ +export interface IPostsData { + status_code: number; + message: string; + data: Data; +} + +export interface Data { + current_page: number; + data: Datum[]; + first_page_url: string; + from: number; + last_page: number; + last_page_url: string; + next_page_url: string; + path: string; + per_page: string; + prev_page_url: null; + to: number; + total: number; +} + +export interface Datum { + id: number; + title: string; + slug: string; + excerpt: string; + published_at: string; + summary: string; + has_summary: boolean; + categories: Category[]; +} + +export interface Category { + id: number; + name: string; + pivot: Pivot; +} + +export interface Pivot { + post_id: number; + category_id: number; +}