JavaScript iterate over array of elements and return a single element based on max px size

I have several elements on a page that are positioned absolutely.

I am trying to iterate over them and find the one which has the highest top value.

I have tried the following toggling off 1 and 2 respectively):

const elems = document.querySelectorAll('.index-posts > li');

const newElems = [...elems].filter(item => Math.max(parseInt(item?.style?.top))); // returns the entire array
const newElems = Math.max([...elems].map(item => parseInt(item?.style?.top?.split('px')[0]))); // returns NaN

By my reckoning the first version should be working but maybe my implementation of Math.max is not quite right. Although perhaps it returns each item because it is the max height per item.

I also found this which I used to create the second var
Finding the max value of a property in an array of objects

const elems = document.querySelectorAll('.index-posts > li');

// const newElems = [...elems].filter(item => Math.max(parseInt(item?.style?.top)));

const newElems = Math.max([...elems].map(item => parseInt(item.style.top.split('px')[0])));

console.log(newElems);
<ul class="index-posts row"><li id="affirmation" style="top: 3px; left: 0%;">
            <a href="affirmation" class="post-trigger">
                <p class="item-name">affirmation</p><p>
                </p><p></p></a><p class="npf_link" data-npf="{&quot;type&quot;:&quot;link&quot;,&quot;url&quot;:&quot;https://vimeo.com/153949952?share=copy&quot;,&quot;display_url&quot;:&quot;https://vimeo.com/153949952?share=copy&quot;,&quot;title&quot;:&quot;Affirmation (2016)&quot;,&quot;description&quot;:&quot;Affirmation (2016) uses footage from the 1923 Buster Keaton film Three Ages as the basis for a guided meditation in vulnerability. Keaton wa&quot;,&quot;site_name&quot;:&quot;Vimeo&quot;,&quot;poster&quot;:[{&quot;media_key&quot;:&quot;cd78c9656df6b9381417c980464efff7:86fa2ab3c65a5863-70&quot;,&quot;type&quot;:&quot;image/webp&quot;,&quot;width&quot;:1920,&quot;height&quot;:1080}]}"><a href="affirmation" class="post-trigger"></a><a href="https://vimeo.com/153949952?share=copy" target="_blank">Affirmation (2016)</a></p><p>Affirmation <br>2016<br>Single channel video</p><p>Affirmation uses footage from the 1923 Buster Keaton film Three Ages as the basis for a guided meditation in vulnerability. Keaton was badly injured shooting this portion of the film and chose to keep the jarring moment of impact in the finished comedy.</p><p></p>
            
        </li><li id="effort" style="top: 261px;">
            <a href="effort" class="post-trigger">
                <p class="item-name">effort</p><p>
                </p><p></p><div class="npf_row"><figure class="tmblr-full" data-orig-height="1000" data-orig-width="713"><img src="https://64.media.tumblr.com/d0d03da92f0ec700bf9aae4d6912dd38/b1f2ac6c91328716-f2/s640x960/9eb6114bae89b82c69822fed1f6f4ad34335049e.jpg" data-orig-height="1000" data-orig-width="713" srcset="https://64.media.tumblr.com/d0d03da92f0ec700bf9aae4d6912dd38/b1f2ac6c91328716-f2/s75x75_c1/2cc38731a6a28c2f0c733a297cd0930a09bc9df7.jpg 75w, https://64.media.tumblr.com/d0d03da92f0ec700bf9aae4d6912dd38/b1f2ac6c91328716-f2/s100x200/ae323c424555c9db2e1b3d3c261a8e34e8887ea2.jpg 100w, https://64.media.tumblr.com/d0d03da92f0ec700bf9aae4d6912dd38/b1f2ac6c91328716-f2/s250x400/2230190d1b796e0bb2c3d06a4d3340bcd82ba996.jpg 250w, https://64.media.tumblr.com/d0d03da92f0ec700bf9aae4d6912dd38/b1f2ac6c91328716-f2/s400x600/08a6c1efdff0e7d27ac13700f41bdcb5daf294ea.jpg 400w, https://64.media.tumblr.com/d0d03da92f0ec700bf9aae4d6912dd38/b1f2ac6c91328716-f2/s500x750/d9b6655f9c05f336b79414f2b9c4ad233e64caa4.jpg 500w, https://64.media.tumblr.com/d0d03da92f0ec700bf9aae4d6912dd38/b1f2ac6c91328716-f2/s540x810/9f04cbd2451438359fdf209cbb3d63010b9a98dd.jpg 540w, https://64.media.tumblr.com/d0d03da92f0ec700bf9aae4d6912dd38/b1f2ac6c91328716-f2/s640x960/9eb6114bae89b82c69822fed1f6f4ad34335049e.jpg 640w, https://64.media.tumblr.com/d0d03da92f0ec700bf9aae4d6912dd38/b1f2ac6c91328716-f2/s1280x1920/45e28d03b9f19b8c11bd5cfb4e156fadb1c55cc2.jpg 713w" sizes="(max-width: 713px) 100vw, 713px"></figure></div><p>Effort! We Cried<br>2015<br>Graphite on paper</p><p></p>
            </a>
        </li><li id="gods_and_monsters" style="top: 693px; left: 64%;">
            <a href="gods_and_monsters" class="post-trigger">
                <p class="item-name">gods_and_monsters</p><p>
                </p><p></p><div class="npf_row"><figure class="tmblr-full" data-orig-height="1127" data-orig-width="1600"><img src="https://64.media.tumblr.com/4b399cc6c60cedadcc68ab1fa071ebd3/a2e7db5f1c359aa0-ee/s640x960/9dd2426e8f33676d1bf6e6ce36e4b8821deabff9.jpg" data-orig-height="1127" data-orig-width="1600" srcset="https://64.media.tumblr.com/4b399cc6c60cedadcc68ab1fa071ebd3/a2e7db5f1c359aa0-ee/s75x75_c1/82270247b35222ceb18cab29951708b72c94744a.jpg 75w, https://64.media.tumblr.com/4b399cc6c60cedadcc68ab1fa071ebd3/a2e7db5f1c359aa0-ee/s100x200/d2fd855eb165cae8f704d984ee6d6a2e69625067.jpg 100w, https://64.media.tumblr.com/4b399cc6c60cedadcc68ab1fa071ebd3/a2e7db5f1c359aa0-ee/s250x400/4f2301e431b81a3664f0d7a9ff13a7d7a724147b.jpg 250w, https://64.media.tumblr.com/4b399cc6c60cedadcc68ab1fa071ebd3/a2e7db5f1c359aa0-ee/s400x600/3e92e57e70820b607151770f4bf5ebfb80cc1084.jpg 400w, https://64.media.tumblr.com/4b399cc6c60cedadcc68ab1fa071ebd3/a2e7db5f1c359aa0-ee/s500x750/1173c49cff5b2cbf363bebb688cdb1454335f178.jpg 500w, https://64.media.tumblr.com/4b399cc6c60cedadcc68ab1fa071ebd3/a2e7db5f1c359aa0-ee/s540x810/641315a2992d144de36e7b635f5d4078407f2d86.jpg 540w, https://64.media.tumblr.com/4b399cc6c60cedadcc68ab1fa071ebd3/a2e7db5f1c359aa0-ee/s640x960/9dd2426e8f33676d1bf6e6ce36e4b8821deabff9.jpg 640w, https://64.media.tumblr.com/4b399cc6c60cedadcc68ab1fa071ebd3/a2e7db5f1c359aa0-ee/s1280x1920/7a49988e09cacb2a34d8d2cd1deee65d318d326a.jpg 1280w, https://64.media.tumblr.com/4b399cc6c60cedadcc68ab1fa071ebd3/a2e7db5f1c359aa0-ee/s2048x3072/1241a81bc082dedfac48d65312e83d5560437851.jpg 1600w" sizes="(max-width: 1280px) 100vw, 1280px"></figure></div><div class="npf_row"><figure class="tmblr-full" data-orig-height="1133" data-orig-width="1600"><img src="https://64.media.tumblr.com/40e63fdb3b123969b7e6a6db269ae90f/a2e7db5f1c359aa0-d4/s640x960/ab06b023935cdd4952a76175818ae829bb44d117.jpg" data-orig-height="1133" data-orig-width="1600" srcset="https://64.media.tumblr.com/40e63fdb3b123969b7e6a6db269ae90f/a2e7db5f1c359aa0-d4/s75x75_c1/19b8d86b15b1573198c51386fd1564c130d395f2.jpg 75w, https://64.media.tumblr.com/40e63fdb3b123969b7e6a6db269ae90f/a2e7db5f1c359aa0-d4/s100x200/ae5f9a4ddcee4ed3241eb52d41eccf8d1601cd37.jpg 100w, https://64.media.tumblr.com/40e63fdb3b123969b7e6a6db269ae90f/a2e7db5f1c359aa0-d4/s250x400/ed3b92d3e926ea3074e9586da2cb2d4fa4db0fdf.jpg 250w, https://64.media.tumblr.com/40e63fdb3b123969b7e6a6db269ae90f/a2e7db5f1c359aa0-d4/s400x600/e1fe9708e8f136671961bee70c6c55f712a71bb3.jpg 400w, https://64.media.tumblr.com/40e63fdb3b123969b7e6a6db269ae90f/a2e7db5f1c359aa0-d4/s500x750/5b1d130c6d65e06c03af8809679e3d0c3dc582af.jpg 500w, https://64.media.tumblr.com/40e63fdb3b123969b7e6a6db269ae90f/a2e7db5f1c359aa0-d4/s540x810/6d3ac9afbc7a616a2f1b70d324728a9b99ff7c0f.jpg 540w, https://64.media.tumblr.com/40e63fdb3b123969b7e6a6db269ae90f/a2e7db5f1c359aa0-d4/s640x960/ab06b023935cdd4952a76175818ae829bb44d117.jpg 640w, https://64.media.tumblr.com/40e63fdb3b123969b7e6a6db269ae90f/a2e7db5f1c359aa0-d4/s1280x1920/5850982fab64960722b13b44de2372836deabe83.jpg 1280w, https://64.media.tumblr.com/40e63fdb3b123969b7e6a6db269ae90f/a2e7db5f1c359aa0-d4/s2048x3072/2dd480b82c5ebc16067e80a5beee41d845f7d6af.jpg 1600w" sizes="(max-width: 1280px) 100vw, 1280px"></figure></div><p>Gods and Monsters <br>2019<br>A series of five hand-lettered postcards sent to the authorities in the artist’s life.</p><p>Recipients: UK Home Office, Arts Council England, U.S. Embassy London, Northamptonshire County Council, the artist’s parents</p><p></p>
            </a>
        </li><li id="icebergs" style="top: 1351px; height: 323px; width: 23%; left: 18%;">
            <a href="icebergs" class="post-trigger">
                <p class="item-name">icebergs</p><p>
                </p><p></p><div class="npf_row"><figure class="tmblr-full" data-orig-height="2744" data-orig-width="2768"><img src="https://64.media.tumblr.com/4736c31d438c972627c101383a5e87b4/c53eef444214311f-4b/s640x960/6bd0bd6a4978e953ba7049090ca983550188a816.jpg" data-orig-height="2744" data-orig-width="2768" srcset="https://64.media.tumblr.com/4736c31d438c972627c101383a5e87b4/c53eef444214311f-4b/s75x75_c1/14ae47d022ae43d026221e38e2f3f0fb0abf8971.jpg 75w, https://64.media.tumblr.com/4736c31d438c972627c101383a5e87b4/c53eef444214311f-4b/s100x200/beb98adf13c0a47a8ce5c3fc77568fff1f581753.jpg 100w, https://64.media.tumblr.com/4736c31d438c972627c101383a5e87b4/c53eef444214311f-4b/s250x400/041fef40aba89b1c98999384f040d7acb55c5b75.jpg 250w, https://64.media.tumblr.com/4736c31d438c972627c101383a5e87b4/c53eef444214311f-4b/s400x600/63d640ad3f8c1c88c25f5d8c735a8c394b22a5da.jpg 400w, https://64.media.tumblr.com/4736c31d438c972627c101383a5e87b4/c53eef444214311f-4b/s500x750/c440119d5ebd89f347ba1ee1bb316937252c84ee.jpg 500w, https://64.media.tumblr.com/4736c31d438c972627c101383a5e87b4/c53eef444214311f-4b/s540x810/97489f044a1e170ed6f02dcedba98e99a085bd2b.jpg 540w, https://64.media.tumblr.com/4736c31d438c972627c101383a5e87b4/c53eef444214311f-4b/s640x960/6bd0bd6a4978e953ba7049090ca983550188a816.jpg 640w, https://64.media.tumblr.com/4736c31d438c972627c101383a5e87b4/c53eef444214311f-4b/s1280x1920/f8a8b1864ed64ca44bb7102a678e4f0ac082c701.jpg 1280w, https://64.media.tumblr.com/4736c31d438c972627c101383a5e87b4/c53eef444214311f-4b/s2048x3072/fd919ad6408a099544f7a4b3c3622c5eadea655d.jpg 2048w" sizes="(max-width: 1280px) 100vw, 1280px"></figure></div><p>I only paint icebergs <br>2014-current <br>Acrylic on canvas</p><p></p>
            </a>
        </li><li id="nameless_befores" style="top: 351px; height: 247px;">
            <a href="nameless_befores" class="post-trigger">
                <p class="item-name">nameless_befores</p><p>
                </p><p></p><div class="npf_row"><figure class="tmblr-full" data-orig-height="3419" data-orig-width="2230"><img src="https://64.media.tumblr.com/7a0b55d3164969c5d7ed2a5e1ad558c2/ecdcd2893cf24923-8c/s640x960/06873ae01989f545e42f6230d307a510d07cd5a9.jpg" data-orig-height="3419" data-orig-width="2230" srcset="https://64.media.tumblr.com/7a0b55d3164969c5d7ed2a5e1ad558c2/ecdcd2893cf24923-8c/s75x75_c1/7308505c10b07da0ef4acdcb3b229eea2551ac7b.jpg 75w, https://64.media.tumblr.com/7a0b55d3164969c5d7ed2a5e1ad558c2/ecdcd2893cf24923-8c/s100x200/389b54834be0f04a1811474cd45aec9c23251834.jpg 100w, https://64.media.tumblr.com/7a0b55d3164969c5d7ed2a5e1ad558c2/ecdcd2893cf24923-8c/s250x400/bd248b00d0c76e442ec66ae04616f4c1e97cee38.jpg 250w, https://64.media.tumblr.com/7a0b55d3164969c5d7ed2a5e1ad558c2/ecdcd2893cf24923-8c/s400x600/6cf86776dd1b6a9b8eecfd0adff76af55fd821ed.jpg 391w, https://64.media.tumblr.com/7a0b55d3164969c5d7ed2a5e1ad558c2/ecdcd2893cf24923-8c/s500x750/204d84a576e75531474a0fa42025c5721fa7cd27.jpg 489w, https://64.media.tumblr.com/7a0b55d3164969c5d7ed2a5e1ad558c2/ecdcd2893cf24923-8c/s540x810/1e68a30f17da789984fae65001d59c1a4c0f27e3.jpg 528w, https://64.media.tumblr.com/7a0b55d3164969c5d7ed2a5e1ad558c2/ecdcd2893cf24923-8c/s640x960/06873ae01989f545e42f6230d307a510d07cd5a9.jpg 626w, https://64.media.tumblr.com/7a0b55d3164969c5d7ed2a5e1ad558c2/ecdcd2893cf24923-8c/s1280x1920/536d38ca09ed3ee4ae48f68d367b5a7175f62904.jpg 1252w, https://64.media.tumblr.com/7a0b55d3164969c5d7ed2a5e1ad558c2/ecdcd2893cf24923-8c/s2048x3072/b69bbe7884a099a9d28a36e4aef989b918872747.jpg 2004w" sizes="(max-width: 1280px) 100vw, 1280px"></figure></div><p>Nameless Befores<br>2019-2020<br>Collage, graphite and pen on paper</p><p></p>
            </a>
        </li><li id="not_funny" style="top: 273px;">
            <a href="not_funny" class="post-trigger">
                <p class="item-name">not_funny</p><p>
                </p><p></p><div class="npf_row"><figure class="tmblr-full" data-orig-height="2714" data-orig-width="2745"><img src="https://64.media.tumblr.com/a39784308f8ad45b90881f4b30f0fe94/196841d0b63faa59-e9/s640x960/49397d1a483a7266dbec0d04fb10673c77796a14.jpg" data-orig-height="2714" data-orig-width="2745" srcset="https://64.media.tumblr.com/a39784308f8ad45b90881f4b30f0fe94/196841d0b63faa59-e9/s75x75_c1/507989a2dff769f0a66e07f8f687a1848cca5e24.jpg 75w, https://64.media.tumblr.com/a39784308f8ad45b90881f4b30f0fe94/196841d0b63faa59-e9/s100x200/d69ef5ddc45101bbf97478c08cdb5dd80516db21.jpg 100w, https://64.media.tumblr.com/a39784308f8ad45b90881f4b30f0fe94/196841d0b63faa59-e9/s250x400/a526294f20e0876d044ba565bf39f1d1c8b84675.jpg 250w, https://64.media.tumblr.com/a39784308f8ad45b90881f4b30f0fe94/196841d0b63faa59-e9/s400x600/d15c9b620362625981ec73f2f06bdd59af7dfcf2.jpg 400w, https://64.media.tumblr.com/a39784308f8ad45b90881f4b30f0fe94/196841d0b63faa59-e9/s500x750/116e73900acc93b4a792b6fcfd21470eb27724c0.jpg 500w, https://64.media.tumblr.com/a39784308f8ad45b90881f4b30f0fe94/196841d0b63faa59-e9/s540x810/b63d1a5814a77d9642b0ab95c518dddcee6fbcaf.jpg 540w, https://64.media.tumblr.com/a39784308f8ad45b90881f4b30f0fe94/196841d0b63faa59-e9/s640x960/49397d1a483a7266dbec0d04fb10673c77796a14.jpg 640w, https://64.media.tumblr.com/a39784308f8ad45b90881f4b30f0fe94/196841d0b63faa59-e9/s1280x1920/df4cad5016b8043c726dff1a8b0097d2d0fd4f0d.jpg 1280w, https://64.media.tumblr.com/a39784308f8ad45b90881f4b30f0fe94/196841d0b63faa59-e9/s2048x3072/bbd67c52186c4f2909bae8755f1c1b9e3b513fce.jpg 2048w" sizes="(max-width: 1280px) 100vw, 1280px"></figure></div><p>I’M NOT FUNNY ANYMORE<br>2022-2023<br>Coloured pencil and marker on paper</p><p></p>
            </a>
        </li><li id="photogram" style="top: 683px;">
            <a href="photogram" class="post-trigger">
                <p class="item-name">photogram</p><p>
                </p><p></p><div class="npf_row"><figure class="tmblr-full" data-orig-height="6797" data-orig-width="8389"><img src="https://64.media.tumblr.com/8b285a90b66b30f8c648f82535ec4cda/0ca99e56b3c437b7-30/s640x960/75784a6bfcbd4961f8ab174bc6f9ca224af4dbca.jpg" data-orig-height="6797" data-orig-width="8389" srcset="https://64.media.tumblr.com/8b285a90b66b30f8c648f82535ec4cda/0ca99e56b3c437b7-30/s75x75_c1/d477768c521c536669974af46e641a246374e773.jpg 75w, https://64.media.tumblr.com/8b285a90b66b30f8c648f82535ec4cda/0ca99e56b3c437b7-30/s100x200/8d0c2fdf1c40ba99b563a76053336c442ef88deb.jpg 100w, https://64.media.tumblr.com/8b285a90b66b30f8c648f82535ec4cda/0ca99e56b3c437b7-30/s250x400/5fbee7381136b7bb1a12dfa7f58d39b90325b02d.jpg 250w, https://64.media.tumblr.com/8b285a90b66b30f8c648f82535ec4cda/0ca99e56b3c437b7-30/s400x600/14099ca7545b18bf5dd81fdbf47e19ddf004e5f7.jpg 400w, https://64.media.tumblr.com/8b285a90b66b30f8c648f82535ec4cda/0ca99e56b3c437b7-30/s500x750/1b1073b976f22c9648d8498cb1ab00fabf241a98.jpg 500w, https://64.media.tumblr.com/8b285a90b66b30f8c648f82535ec4cda/0ca99e56b3c437b7-30/s540x810/9d1de80bcd46f14eafa6b78ca616f90378d7f85a.jpg 540w, https://64.media.tumblr.com/8b285a90b66b30f8c648f82535ec4cda/0ca99e56b3c437b7-30/s640x960/75784a6bfcbd4961f8ab174bc6f9ca224af4dbca.jpg 640w, https://64.media.tumblr.com/8b285a90b66b30f8c648f82535ec4cda/0ca99e56b3c437b7-30/s1280x1920/44fbd64f8f5a68479a092290d3bebf419e0bc14d.jpg 1280w, https://64.media.tumblr.com/8b285a90b66b30f8c648f82535ec4cda/0ca99e56b3c437b7-30/s2048x3072/a330b0d05ac886e1ef6c909aea4700cf3972b68b.jpg 2048w" sizes="(max-width: 1280px) 100vw, 1280px"></figure></div><p>Instant colour photogram<br>2021</p><p></p>
            </a>
        </li><li id="referendum" style="top: 611px; height: 446px; left: 14%;">
            <a href="referendum" class="post-trigger">
                <p class="item-name">referendum</p><p>
                </p><p></p><figure class="tmblr-full tmblr-embed" data-provider="vimeo" data-url="https://vimeo.com/221735806?share=copy" data-orig-width="540" data-orig-height="304"><iframe src="https://player.vimeo.com/video/221735806?title=0&amp;byline=0&amp;portrait=0&amp;app_id=122963" width="540" height="304" frameborder="0" allow="autoplay; fullscreen; picture-in-picture; clipboard-write" title="Video clip depicting interactive online work Referendum (Tell Me How Do You Feel)"></iframe></figure><p>Referendum (Tell Me How Do You Feel)<br>2016-2017<br>Interactive online work</p><p>Referendum (Tell Me How Do You Feel) was an interactive online sister piece to the physical installation of the same name, requiring the viewer to vote on the artist’s citizenship. The online iteration reduced the practical and legal arguments for citizenship to a flood of visuals concerning the country of the artist’s birth and the country the artist now calls home, along with a quote from Rebecca Solnit’s book Wanderlust: A History of Walking.</p></a><p><a href="referendum" class="post-trigger">This work was commissioned by Fermynwoods Contemporary Art for its </a><a href="https://www.a-n.co.uk/news/online-exhibition-sees-us-artists-respond-to-trump-presidency/">Open 7: Can You Hear Me?</a></p><p></p>
            
        </li><li id="shield" style="top: 625px; height: 458px;">
            <a href="shield" class="post-trigger">
                <p class="item-name">shield</p><p>
                </p><p></p><div class="npf_row"><figure class="tmblr-full" data-orig-height="4032" data-orig-width="2640"><img src="https://64.media.tumblr.com/49d61fefb0215ba9d4b0af70a6e5c688/2c5835b67d79732a-9a/s640x960/d85c9c2f7f4ff41832f548cc2cac89905e6fe01b.jpg" data-orig-height="4032" data-orig-width="2640" srcset="https://64.media.tumblr.com/49d61fefb0215ba9d4b0af70a6e5c688/2c5835b67d79732a-9a/s75x75_c1/eb876d72933b6138eeba73ca59499c3809975b61.jpg 75w, https://64.media.tumblr.com/49d61fefb0215ba9d4b0af70a6e5c688/2c5835b67d79732a-9a/s100x200/21f86af6b60e44ba7d90090281dc1a1461494805.jpg 100w, https://64.media.tumblr.com/49d61fefb0215ba9d4b0af70a6e5c688/2c5835b67d79732a-9a/s250x400/eba73e6b36bf95f9473e9276592794923583d9de.jpg 250w, https://64.media.tumblr.com/49d61fefb0215ba9d4b0af70a6e5c688/2c5835b67d79732a-9a/s400x600/f202a41604edd3e6cfeee2f9457620bbc87accff.jpg 393w, https://64.media.tumblr.com/49d61fefb0215ba9d4b0af70a6e5c688/2c5835b67d79732a-9a/s500x750/3def886512d22590bb2b72396d147cb8007ccd46.jpg 491w, https://64.media.tumblr.com/49d61fefb0215ba9d4b0af70a6e5c688/2c5835b67d79732a-9a/s540x810/d83eb22083d9dafb4feae95e2f4a2ca0553e0ae8.jpg 530w, https://64.media.tumblr.com/49d61fefb0215ba9d4b0af70a6e5c688/2c5835b67d79732a-9a/s640x960/d85c9c2f7f4ff41832f548cc2cac89905e6fe01b.jpg 629w, https://64.media.tumblr.com/49d61fefb0215ba9d4b0af70a6e5c688/2c5835b67d79732a-9a/s1280x1920/1c03d83fdad14df8334745de77595cd9d2215ce7.jpg 1257w, https://64.media.tumblr.com/49d61fefb0215ba9d4b0af70a6e5c688/2c5835b67d79732a-9a/s2048x3072/ee6e6bf1448c6304fbf6cbed93062b9ca520baf3.jpg 2011w" sizes="(max-width: 1280px) 100vw, 1280px"></figure></div><p>Shield<br>2018<br>Wax, display case, light</p><p>Shield is a meditation on masculinity and power. The tiles are wax casts of the substantial belt buckle once belonging to the artist’s grandfather, who was a Chicago Police Sergeant investigated in the 1970s as part of a ring of police shaking down motorists for payoffs. While eventually granted immunity from prosecution by the state, he was indicted, along with two fellow policemen, for perjury by a grand jury for lying about his involvement.</p><p></p>
            </a>
        </li><li id="tappatappatappa" style="top: 352px; height: 249px;">
            <a href="tappatappatappa" class="post-trigger">
                <p class="item-name">tappatappatappa</p><p>
                </p><p></p><div class="npf_row"><figure class="tmblr-full" data-orig-height="570" data-orig-width="570"><img src="https://64.media.tumblr.com/e941cce115f54b050dd2fdae5366580b/6fad0e4f24c9057d-1f/s640x960/42553538aedce243e572d658fdb3e3a805e22d05.jpg" data-orig-height="570" data-orig-width="570" srcset="https://64.media.tumblr.com/e941cce115f54b050dd2fdae5366580b/6fad0e4f24c9057d-1f/s75x75_c1/f3f6e1ed40aeb78963cb1da70f1513d4c82ad0c5.jpg 75w, https://64.media.tumblr.com/e941cce115f54b050dd2fdae5366580b/6fad0e4f24c9057d-1f/s100x200/748ebcf728a133b679f467b72feb3029bab26394.jpg 100w, https://64.media.tumblr.com/e941cce115f54b050dd2fdae5366580b/6fad0e4f24c9057d-1f/s250x400/ecc972107a967547438aa98b954d349ae74463dc.jpg 250w, https://64.media.tumblr.com/e941cce115f54b050dd2fdae5366580b/6fad0e4f24c9057d-1f/s400x600/f254547b7528a35626354375ffaf3ad33dca3b69.jpg 400w, https://64.media.tumblr.com/e941cce115f54b050dd2fdae5366580b/6fad0e4f24c9057d-1f/s500x750/0803bac2b9ceae3a2be4d98974e110928688b3cd.jpg 500w, https://64.media.tumblr.com/e941cce115f54b050dd2fdae5366580b/6fad0e4f24c9057d-1f/s540x810/2658da93ea7df6208e5b77ab0a8c15c2e05183ab.jpg 540w, https://64.media.tumblr.com/e941cce115f54b050dd2fdae5366580b/6fad0e4f24c9057d-1f/s640x960/42553538aedce243e572d658fdb3e3a805e22d05.jpg 570w" sizes="(max-width: 570px) 100vw, 570px"></figure></div><p>TAPPA TAPPA TAPPA<br>2012-2018<br>Series of five zines</p></a><p><a href="tappatappatappa" class="post-trigger"></a><a href="https://www.tappazine.com/">TAPPA TAPPA TAPPA</a> was a collaboration between writer Amy Pettifer and artist Jessica Harby.</p><p></p>
            
        </li><li id="the_thing" style="top: 485px; left: 31%;">
            <a href="the_thing" class="post-trigger">
                <p class="item-name">the_thing</p><p>
                </p><p></p><div class="npf_row"><figure class="tmblr-full" data-orig-height="1728" data-orig-width="2592"><img src="https://64.media.tumblr.com/df886ab0308a396250010d9022f4146a/5c1228652df16585-5d/s640x960/f5f5e93cd13d9e3afeb405a2ec221aae406affe8.jpg" data-orig-height="1728" data-orig-width="2592" srcset="https://64.media.tumblr.com/df886ab0308a396250010d9022f4146a/5c1228652df16585-5d/s75x75_c1/6644c7c9ce264760c5f82a1964a8628e952040d8.jpg 75w, https://64.media.tumblr.com/df886ab0308a396250010d9022f4146a/5c1228652df16585-5d/s100x200/ba913b19ba04c397bbba8d92aafeb74af4e629ab.jpg 100w, https://64.media.tumblr.com/df886ab0308a396250010d9022f4146a/5c1228652df16585-5d/s250x400/f0e9373a98434a971bca275dda5d171f0f42afe3.jpg 250w, https://64.media.tumblr.com/df886ab0308a396250010d9022f4146a/5c1228652df16585-5d/s400x600/a33687ea9733cacda6aea68c073a62dabcb98fbc.jpg 400w, https://64.media.tumblr.com/df886ab0308a396250010d9022f4146a/5c1228652df16585-5d/s500x750/af0cd2660d8448fd4901d4f56263ed1b0c2e597f.jpg 500w, https://64.media.tumblr.com/df886ab0308a396250010d9022f4146a/5c1228652df16585-5d/s540x810/1726cb1c8f70f83678ae2c84393657024fc05e4c.jpg 540w, https://64.media.tumblr.com/df886ab0308a396250010d9022f4146a/5c1228652df16585-5d/s640x960/f5f5e93cd13d9e3afeb405a2ec221aae406affe8.jpg 640w, https://64.media.tumblr.com/df886ab0308a396250010d9022f4146a/5c1228652df16585-5d/s1280x1920/93d5d5b9d7f12d636105d585c3c2b18b87405994.jpg 1280w, https://64.media.tumblr.com/df886ab0308a396250010d9022f4146a/5c1228652df16585-5d/s2048x3072/4f397f37f1e6839699631552da450b3d1b9ab6c4.jpg 2048w" sizes="(max-width: 1280px) 100vw, 1280px"></figure></div><p>The Thing or The Oh Noeux Tapestry<br>2017<br>Embroidery on Canvas</p><p>The Thing or The Oh Noeux Tapestry is a fourteen-metre long work of endurance embroidery began 1 January 2017 and completed 31 December 2017, documenting the news and the process of consuming it.</p><p></p>
            </a>
        </li><li id="tiny_malevolent" style="top: -12px; height: 342px; width: 41%; left: 47%;">
            <a href="tiny_malevolent" class="post-trigger">
                <p class="item-name">tiny_malevolent</p><p>
                </p><p></p><div class="npf_row"><figure class="tmblr-full" data-orig-height="2123" data-orig-width="2875"><img src="https://64.media.tumblr.com/3e08839dca1e50d94c5f6aaf5d9ed5db/c53be9c758c4c913-52/s640x960/a97988384b36163b04f0cb5e3077880eeb4e41d7.jpg" data-orig-height="2123" data-orig-width="2875" srcset="https://64.media.tumblr.com/3e08839dca1e50d94c5f6aaf5d9ed5db/c53be9c758c4c913-52/s75x75_c1/b697df9126fd9af3cd59caaebb8b057f101f9f43.jpg 75w, https://64.media.tumblr.com/3e08839dca1e50d94c5f6aaf5d9ed5db/c53be9c758c4c913-52/s100x200/5e3ef7ee5db72e68ff449147e812f13c5ce0c5d3.jpg 100w, https://64.media.tumblr.com/3e08839dca1e50d94c5f6aaf5d9ed5db/c53be9c758c4c913-52/s250x400/ef8d4d1465b0b21a34960b781b1f145ee6f8404a.jpg 250w, https://64.media.tumblr.com/3e08839dca1e50d94c5f6aaf5d9ed5db/c53be9c758c4c913-52/s400x600/df6c546703bceedd9a55c2c53d94d5f3b8cbdab0.jpg 400w, https://64.media.tumblr.com/3e08839dca1e50d94c5f6aaf5d9ed5db/c53be9c758c4c913-52/s500x750/4aff1e7a88cc3a0bc7ea80d50e864ef62b8aa636.jpg 500w, https://64.media.tumblr.com/3e08839dca1e50d94c5f6aaf5d9ed5db/c53be9c758c4c913-52/s540x810/a65b32cd5e2472410c10ac43cadcb0497cd85d7f.jpg 540w, https://64.media.tumblr.com/3e08839dca1e50d94c5f6aaf5d9ed5db/c53be9c758c4c913-52/s640x960/a97988384b36163b04f0cb5e3077880eeb4e41d7.jpg 640w, https://64.media.tumblr.com/3e08839dca1e50d94c5f6aaf5d9ed5db/c53be9c758c4c913-52/s1280x1920/94e9654f3e6bde6d0490e3546786d434362947b7.jpg 1280w, https://64.media.tumblr.com/3e08839dca1e50d94c5f6aaf5d9ed5db/c53be9c758c4c913-52/s2048x3072/14ae3d38534b6379aebbaf11d6c201a61d86de3a.jpg 2048w" sizes="(max-width: 1280px) 100vw, 1280px"></figure></div><p>Tiny Malevolent Women<br>2018-2019<br>Charcoal and graphite on paper</p><p>A series of drawings depicting:<br>The Mourners<br>The Climber<br>The Rat King<br>The Quorum<br>The Rat King<br>The Seamstresses<br>The Devil’s Triangle<br>The Watchful Eye Which Has Not and Will Not Rest<br>The Again<br>The Again<br>The Again<br>The Again<br>The Again</p><p></p>
            </a>
        </li><li id="very_realistic" style="top: 2px; height: 248px; left: 14%;">
            <a href="very_realistic" class="post-trigger">
                <p class="item-name">very_realistic</p><p>
                </p><p></p><figure class="tmblr-full tmblr-embed" data-provider="vimeo" data-url="https://vimeo.com/544276930?share=copy" data-orig-width="540" data-orig-height="304"><iframe src="https://player.vimeo.com/video/544276930?title=0&amp;byline=0&amp;portrait=0&amp;app_id=122963" width="540" height="304" frameborder="0" allow="autoplay; fullscreen; picture-in-picture; clipboard-write" title="Very Realistic (2021)"></iframe></figure><p>Very Realistic<br>2021<br>Single channel video </p><p>In The Great Muppet Caper (1981), reporters Kermit, Fozzie, and Gonzo travel to London to investigate a jewel theft. Whilst riding in a red double-decker bus over the Thames, the following exchange takes place:</p><p>Fozzie: Wow, look at the scenery!<br>Gonzo: It’s very realistic.</p><p>It is 2021, we have lived/are living through a collective trauma and during a car ride the landscape turned to a throbbing reality and we secretly begged to be let back inside.</p><p></p>
            </a>
        </li></ul>

There is also a JSFIDDLE here: https://jsfiddle.net/lharby/382yunhq/ where I have tried more verbose methods.

If anyone can point me in the right direction I would appreciate it.

how to sort array of nested objects by the objects name

I have this multidimensional object from an API:

let curr = {
    "base_currency_code": "EUR",
    "base_currency_name": "Euro",
    "amount": "10.0000",
    "updated_date": "2024-04-14",
    "rates": {        
        "USD": {
            "currency_name": "United States dollar",
            "rate": "1.0649",
            "rate_for_amount": "10.6489"
        },
        "AUD": {
            "currency_name": "Australian dollar",
            "rate": "1.6444",
            "rate_for_amount": "16.4443"
        },
        "CAD": {
            "currency_name": "Canadian dollar",
            "rate": "1.4669",
            "rate_for_amount": "14.6690"
        }
    },
    "status": "success"
}

And I want a sorted array of objects like this :

let curr = [
    {
        "id": "AUD",
        "currency_name": "Australian dollar",
        "rate": "1.6444",
        "rate_for_amount": "16.4443"
    },
    {
        "id": "CAD",
        "currency_name": "Canadian dollar",
        "rate": "1.4669",
        "rate_for_amount": "14.6690"
    },
    {
        "id": "USD",
        "currency_name": "United States dollar",
        "rate": "1.0649",
        "rate_for_amount": "10.6489"
    }
]

The goal would be to adapt it for a Flatlist in react-native.
Been trying many tricks but nothing works. Any suggestions?

Updating to react native 0.73 , UI is freezing and becomes unresponsive with react-native-maps in use

I have updated an app to latest react native 0.73.x , Production app UI on iOS starts to freeze and becomes unresponsive , I load react-native-maps with lots of markers as the main screen , There was no performance issues before the update, any idea ?

I also noticed this error on iOS xcode logs which might be related

This method can cause UI unresponsiveness if invoked on the main thread. Instead, consider waiting for the -locationManagerDidChangeAuthorization: callback and checking authorizationStatus first.

Uncaught SyntaxError: Identifier ‘dashboard_process’ has already been declared (at dashboard-process.js:1:1)

 <div class="d-flex flex-column mb-3 fv-row fv-plugins-icon-container">
    <button type="button" class="btn btn-warning" onclick="_dashboard_process_manager.uploadExcelForRunProcess()">Dosya Ekle</button>
</div>

What am I doing wrong? I added the previously defined Dashboard_process definitions to the comment line. However, it still gives the same error.

@section scripts {
       <script src="~/custom/dashboard-process.js"></script>
    
        <script>
          var _dashboard_process_manager = new dashboard_process();
         
        </script>
    }

dashboard-process.js :

class dashboard_process {
 uploadExcelForRunProcess = function () {
     $.get("/ManageData/UploadExcel?companyPersonSubProcessId=" + $('#CompanyPersonSubProcessId').val() + "&path=" + $('#Path').val(), function (data, status) {
         if (data.isSuccess) {
             Swal.fire(data.message, '', 'isConfirmed').then(function () {
                 window.location.reload();
             })
         }
         else {
             Swal.fire(data.message, '', 'warning').then(function () {
                 window.location.reload();
             })
         }
     });
 }
}

Here Path = null.The same code works on another page. I don’t understand why it doesn’t work here.

How to add a custom theme with a custom authenticator in keycloak?

I am creating my custom authenticator for 2FA using SMS TOTP verifications in KEYCLOAK.

Here, I am showing mobile form and otp pages to the users to first enter the mobile number and then the otp that I am sending through sms via my custom auth.

My custom auth is working as expected.

Now I am trying to override the login pages with my custom theme, Here I am facing an issue in transferring data from my custom theme to my custom authenticator for further evaluations. Moreover, I am also not able to redirect the page to a new page once the user clicks on SUBMIT Button.

Some Code Samples are added below for better understanding:-

Custom Authenticator:-

public class SmsAuthenticator extends UsernameFormFactory implements Authenticator {

    @Override
    public void authenticate(AuthenticationFlowContext context) {


        AuthenticationSessionModel authSession = context.getAuthenticationSession();
        authSession.setAuthNote("formType", "mobile");
        context.challenge(context.form().createForm("mobile-form.ftl"));
    }

    @Override
    public void action(AuthenticationFlowContext context) {

       // Code to send Otp
            authSession.removeAuthNote("formType");
            authSession.setAuthNote("formType", "otp");
            context.challenge(context.form().createForm("login-otp.ftl"));
    }

Below is my custom theme code for mobile-form.ftl

KCApp.tx

case “mobile-form.ftl”: return <MobileForm {…{ kcContext, i18n,
Template, classes }} doUseDefaultCss={true} />;

MobileForm.tsx

<Template {...{ kcContext, i18n, doUseDefaultCss, classes }} headerNode={"Login with SMS"}>
            <div className="container mx-auto flex flex-wrap items-center">
                <form id="kc-sms-form" action={`/auth/realms/{{realm}}/protocol/openid-connect/auth?mobileNumber=${mobileNumber}`} method=post encType="application/x-www-form-urlencoded" className="w-full max-w-xs">
                    <div className={getClassName("kcFormGroupClass")}>
                        <label htmlFor="mobileNumber" className={getClassName("kcLabelClass")}>
                            Mobile Number
                        </label>
                        <input
                            type="text"
                            id="mobileNumber"
                            name="mobileNumber"
                            value={mobileNumber}
                            onChange={e => setMobileNumber(e.target.value)}
                            className="bg-[#E8E8E8] border-2 border-[#95C11F] rounded-lg p-4 w-full mb-5"
                            autoComplete="off"
                        />
                    </div>
                    <div className={getClassName("kcFormGroupClass")}>
                        <input
                            type="submit"
                            className="btn w-full text-white border-[2px] border-solid border-transparent p-4 rounded-lg overflow-hidden text-base hover:text-white"
                            value="Send SMS"
                        />
                    </div>
                </form>
            </div>
        </Template>

Here after submitting I am able to get the call back to my authenticator code but I am not able to read the data entered by the user in this case ‘mobile number’.

How can I do the same. Any guidance will be highly appreciated.

Thanks

E11000 duplicate key error collection: blog-api.blogs index: id_1 dup key: { id: null }

This is my error

E11000 duplicate key error collection: blog-api.blogs index: id_1 dup
key: { id: null }

When i insert one data it is inserting but after that i tried inserting data i am getting above error.

Following is my blogSchema.js

const mongoose = require("mongoose");

const blogSchema = mongoose.Schema(
  {
    title: { type: String, required: true },
    author: { type: String, required: true },
    body: { type: String, required: true },
    comments: [{ body: String, date: Date }],
    date: { type: Date, default: Date.now },
    picturePath: {
      type: String,
      default: "",
    },
    meta: {
      votes: Number,
      favs: Number,
    },
  },
  { timestamps: true }
);

const Blog = mongoose.model("Blog", blogSchema);

module.exports = Blog;

This is my add blog function

const addBlog = async (req, res) => {
  try {
    const { title, author, body } = req.body;
    const picturePath = req.file.filename;
    const result = await Blog.create({
      title: title,
      author: author,
      body: body,
      picturePath: picturePath,
    });
    res.status(200).send(result);
  } catch (error) {
    console.log(error);
    res.status(500).send("Data format is not valid!");
  }
};

If someone got idea what causing above error please answer it

error: Failed due to error: bunsh: No such file or directory running bun dev

So, I moved on to windows today, i installed Bun, but when I run the script bun dev it says:

error: Failed due to error: bunsh: No such file or directory.

The weird thing is that when i run the same command in terminal, it works.
This is everything I have in my package.json file:

{
  
"name": "app",
  
"version": "1.0.50",
  
"scripts": {

    "dev": "bun --watch run src/index.ts"

  },

 "module": "src/index.js"

}

I already tried to add a ./ in the src/index.ts, I entred into the src directory to run with just the index.ts in the script and didn’t work either.

A flash bug in application caused by Flask, ChatGPT and gTTS

I’m creating a system like an assistant chatbot.
I’m using two types of programing languages, JavaScript and Python.
The system is that put a message in text box and falsk carries it to python code having a respond system by ChatGPT and a generate sound system of it by gTTS.
After flask carries the message to the user interface, it is displayed on the screen.

However, the problem is occurred by putting a message into text box then the screen flash and the system might be reloaded.

This is the code of backend.

import openai
from flask import Flask, request, jsonify
from flask_cors import CORS
from gtts import gTTS

app = Flask(__name__)
CORS(app)

@app.route('/')
def home():
    return "Flask Server is Running!"

@app.route('/ask', methods=['POST'])
def handle_query():
    data = request.json
    prompt = data.get('prompt', '')
    
    api_key = "API_KEY"

    response = openai.ChatCompletion.create(
        model="gpt-3.5-turbo",
        messages=[{"role": "user", "content": prompt}],
        api_key=api_key
    )
    gpt_response = response.choices[0].message['content']
    tts = gTTS(gpt_response, lang='en')
    save_path = "./response.mp3"
    tts.save(save_path)
    
    return jsonify({"response": gpt_response})

if __name__ == '__main__':
    app.run(debug=True, port=5000)

If I delete the part of gTTS, the system can display the response without any problem, but the voice of it can’t be created so that I’m struggling about that.

How does Webpack Module Federation eager dependency work?

From what I understand when using Webpack Module Federation with flag eager dependency set as true, it basically tells Module Federation whether to load the shared dependencies synchronously or asynchronously.
However, I want to understand the above in more detail in terms of what it exactly means AND also how does it work when we have different combinations –

  1. Both Host and Child/Remote setting dependency1 with eager : true
  2. Host sets dependency1 with eager : true, but Child sets the same dependency1 with eager : false

Buttons Frozen After Page Navigation

I have a Group Of Ejs Pages Rendered like this in the app/index.js:


app.get('/Pages/Inventory/:pageNumber', async (req, res) => {
    const pageNumber = parseInt(req.params.pageNumber);
    const pageSize = 20; 

    try {
        const books = await BookInventory.getInventory(pageNumber, pageSize);
        res.render('BookInventory', { books, pageNumber });
    } catch (error) {
        console.error('Error retrieving inventory:', error);
        res.status(500).send('An error occurred.');
    }
});

The Page:


<!DOCTYPE html>

<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Book Inventory</title>
        <link rel="stylesheet" href="../../Styles/BookInventory.css">
        <link rel="stylesheet" href="../../Styles/css/all.css">
        <link rel="icon" href="../../Images/Seal.ico">
        <script src="../../Scripts/BookInventory.js"></script>
    </head>

    <body>
        
        <div class="Wrapper">
            
            <div class="Side-Bar">

                <div class="Side-Bar-Wrapper">

                    <div class="Side-Bar-Label">
                        <p>
                           Book Inventory
                        </p>
                    </div>

                    <div class="Side-Bar-Logo">
                        <img src="../../Images/SchoolLogo.png" width="180px" height="180px">
                    </div>

                    <div class="Side-Bar-Nav">

                        <div class="Side-Bar-Navigator" id="Organizations">
                            <div class="Side-Bar-Navigator-Icon">
                                <i class="fa-solid fa-sitemap"></i>
                                 <!--Icon Goes Here-->
                            </div>
                            <p>
                                User Organization
                            </p>
                        </div>

                        <div class="Side-Bar-Navigator" id="Inventory">
                            <div class="Side-Bar-Navigator-Icon">
                                <i class="fa-solid fa-book"></i>
                                 <!--Icon Goes Here-->
                            </div>
                            <p>
                               Book Inventory
                            </p>
                        </div>

                        <div class="Side-Bar-Navigator" id="Archives">
                            <div class="Side-Bar-Navigator-Icon">
                                <i class="fa-solid fa-box-archive"></i>
                                 <!--Icon Goes Here-->
                            </div>
                            <p>
                               Archives
                            </p>
                        </div>

                        <div class="Side-Bar-Navigator" id="Home">
                            <div class="Side-Bar-Navigator-Icon">
                                <i class="fa-solid fa-house"></i>
                                 <!--Icon Goes Here-->
                            </div>
                            <p>
                               Home
                            </p>
                        </div>

                    </div>

                </div>

            </div>

            <div class="Maincontent">

                <div class="Maincontent-Wrapper">

                    <div class="Top-Controls">
                        <div class="Search-Bar">
                            <input id="InventorySearch" class="Search-Input" type="text" placeholder="Search Inventory">
                            <i class="fa-solid fa-magnifying-glass"></i>
                        </div>
                        <button class="AddBTN" id="Add-User">Add Book</button>
                    </div>

                    <!--For Each Book-->
                    <% books.forEach(book => { %>
                        <div class="Book-Entry" id="<%= book.BookID %>">
                            <div class="Cover">
                                <img src="../<%= book.BookCover %>" class="Entry-Cover">
                            </div>
                            <div class="Info-Block">
                                <span class="Title-Span">
                                    <h1 class="Book-Title"><%= book.BookTitle %></h1>
                                    <button class="Editing-Btn" id="Edit-Title"><i class="fa-solid fa-pen"></i></button>
                                </span>
                                <h2 class="Book-ID"># <%= book.BookID %></h2>
                                <div class="Author-Container">
                                    <h3>Author :</h3>
                                    <p class="Author">
                                        <span class="Book-Author"><%= book.BookAuthor %></span>
                                    </p>
                    
                                    <button class="Editing-Btn" id="Edit-Author">
                                        <i class="fa-solid fa-pen"></i>
                                    </button>
                                </div>
                                <div class="Buttons">
                                    <button class="ArchiveBtn" id="Archive-Book">Archive<i class="fa-solid fa-box-archive"></i></button>
                                </div>
                            </div>
                        </div>
                    <% }); %>

                    <div class="Pagination">
                        <div class="Pagination-Controls" data-pageNumber="1">
                            <button id="Backward">
                                <i class="fa-solid fa-backward"></i>
                            </button>
                            <button id="Forward">
                                <i class="fa-solid fa-forward"></i>
                            </button>
                        </div>
                    </div>

                </div>
                
            </div>

        </div>

    </body>

</html>

The JS:


document.getElementById('Forward').addEventListener('click', () => {
        const currentPageNumber = getCurrentPageNumber();
        const nextPageNumber = currentPageNumber + 1;
        window.location.href = `/Pages/Inventory/${nextPageNumber}`;
    });
    
    document.getElementById('Backward').addEventListener('click', () => {
        const currentPageNumber = getCurrentPageNumber();
        if (currentPageNumber > 1) {
            const prevPageNumber = currentPageNumber - 1;
            window.location.href = `/Pages/Inventory/${prevPageNumber}`;
        }
    });
    
    function getCurrentPageNumber() {
        const currentPagePath = window.location.pathname;
        const pageNumber = currentPagePath.split('/').pop();
        return parseInt(pageNumber);
    }

When i first access the inventory i start at Pages/Inventory/1, and on the first page the pagination navigation works as intended as with the click of the button “forward” button i am able to access Pages/Inventory/2. But this is where the problem rears its head as the pagination controls seem to be frozen? The hover effects doesn’t work on the forward and backward button and neither are they clickable and thus im unable to navigate forward to the third page or even return to the first page via these frozen controls.

Im not too sure what im getting wrong here but if you know the solution or the problem causing this please do lend a helping hand

Stackoverflow 101 [closed]

How can I get started with using Stackoverflow, here on this platform everything seems to be looking foreign. Can I get an introductory video on how to navigate through the platform.

I tried navigating through the website, but I feel like I am lost. I need video or an article that introduces me to the platform on how to go navigate through and make the most of the time spent here.

Getting an [object Object] when trying to convert node Buffer to string

I am building a simple backend for my shop-list js application.

On the fron side I dispatch this POST request:

const saveList = async () => {
  
  const listData = [
    {
        "title": "milk",
        "amount": 1
    },
    {
        "title": "bread",
        "amount": 1
    }
]
  
  await fetch(url, {
    method: 'POST',
    mode: 'cors',
    body: { listData },
    headers: {
      'Content-Type': 'application/json',
      'Access-Control-Allow-Origin': '*',
      'Access-Control-Allow-Methods': 'DELETE, POST, GET, OPTIONS, PUT, HEAD',
      'Access-Control-Allow-Headers':
        'Content-Type, Authorization, X-Requested-With',
    },
  });
};

While on the backend it is recieved by this middleware, its job is to act like a bodyParser,
so to get a Buffer stream and to convert it to a json object.

module.exports = (request, response, next) => {
  const chunks = [];

  request.on('data', (chunk) => {
    chunks.push(chunk);
  });

  request.on('end', () => {
    const acc = Buffer.concat(chunks);

    const stringData = acc.toString();

  });
};

But I am not able to convert the Buffer to string (so I ommited the rest of the middleware for the purpuse of the question)

when I log the acc variable to console I get:

<Buffer 5b 6f 62 6a 65 63 74 20 4f 62 6a 65 63 74 5d>

but when I log the stringData to the console I get:

[object Object]

I tried using the utf-8 in the toString function:

const stringData = acc.toString('utf-8');

I was following this guide to make a CRUD api without framework and in this guide they get the string representation only by using the toString() function on the Buffer.

Numbers on pagination bullets

I came accross a thread on here that shows what I am trying to do, but I can’t figure out how to implement it into an existing site I’m working on. It’s an HTML/JS/CSS site, I have the swiper slideshow set up the way I want but just want to add numbers on the bullets.
What I am trying to achieve is here.

My code I am trying to put it in is here:

html

...
<link rel="stylesheet" href="swiper/css/swiper.min.css">
...
 <div class="swiper-container">
<div class="swiper-wrapper">
    <div class='swiper-slide'><img src='images/ARCHITECTURE/01.jpg' class='respimg'></div>
    <div class='swiper-slide'><img src='images/ARCHITECTURE/02.jpg' class='respimg'></div>
    <div class='swiper-slide'><img src='images/ARCHITECTURE/03.jpg' class='respimg'></div>
    <div class='swiper-slide'><img src='images/ARCHITECTURE/04.jpg' class='respimg'></div>
    <div class='swiper-slide'><img src='images/ARCHITECTURE/05.jpg' class='respimg'></div>
    <div class='swiper-slide'><img src='images/ARCHITECTURE/06.jpg' class='respimg'></div>
    <div class='swiper-slide'><img src='images/ARCHITECTURE/07.jpg' class='respimg'></div>
    <div class='swiper-slide'><img src='images/ARCHITECTURE/08.jpg' class='respimg'></div>
    <div class='swiper-slide'><img src='images/ARCHITECTURE/09.jpg' class='respimg'></div>
    <div class='swiper-slide'><img src='images/ARCHITECTURE/10.jpg' class='respimg'></div>
    <div class='swiper-slide'><img src='images/ARCHITECTURE/11.jpg' class='respimg'></div>
    <div class='swiper-slide'><img src='images/ARCHITECTURE/12.jpg' class='respimg'></div>
    <div class='swiper-slide'><img src='images/ARCHITECTURE/13.jpg' class='respimg'></div>
    <div class='swiper-slide'><img src='images/ARCHITECTURE/14.jpg' class='respimg'></div>
    <div class='swiper-slide'><img src='images/ARCHITECTURE/15.jpg' class='respimg'></div>
    <div class='swiper-slide'><img src='images/ARCHITECTURE/16.jpg' class='respimg'></div>
    <div class='swiper-slide'><img src='images/ARCHITECTURE/17.jpg' class='respimg'></div>
    <div class='swiper-slide'><img src='images/ARCHITECTURE/18.jpg' class='respimg'></div>
    <div class='swiper-slide'><img src='images/ARCHITECTURE/19.jpg' class='respimg'></div>
    </div>
    <div class="swiper-pagination"></div>
  </div>  
...
<script>
    selcat('ARCHITECTURE');
    $('#cARCHITECTURE').addClass('up');
    </script><script>
    $('#p4').addClass('up');
    </script>      </div>
</div>  <script src="swiper/js/swiper.min.js"></script>


<script>
var swiper = new Swiper('.swiper-container', {
    pagination: '.swiper-pagination',
    paginationClickable: true,
    effect: 'fade',
    keyboardControl: true,
    loop: true
});
</script>

css

    /* Slider */
ol.bjqs-markers li a{display:inline-block; font-family: 'Open Sans', sans-serif; font-size: 12px; letter-spacing: 8px; }
ol.bjqs-markers li.active-marker a,
ol.bjqs-markers li a:hover{ color: black; }
ul.bjqs-controls.v-centered li a{ color: black; background: grey; font-family: 'Open Sans', sans-serif; }

/* Swiper */
.swiper-container {
    max-width: 726px; margin: 0 auto;
}
.swiper-slide {
    text-align: center;
    font-size: 18px;
    background: #fff;
    margin-bottom: 30px;
}
.swiper-pagination-bullet {
    width: 10px;
    height: 10px;
    text-align: center;
    line-height: 10px;
    font-family: 'Open Sans', sans-serif;
    font-size: 12px;
    color:#000;
    opacity: 1;
    background: #D0D0D0;
}
.swiper-pagination-bullet-active {
    color:#fff;
    background: #000;
}

I am willing to pay someone who can figure this out!

native decorators in typescript + nextjs

In the writing of mobx I notice the following error:

./src/app/stores/resource_store.ts
Error: 
  × Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key
   ╭─[/Users/paulweijtens/PycharmProjects/take-step/with-redux/src/app/stores/resource_store.ts:3:1]
 3 │ import {createContext} from "react";
 4 │ 
 5 │ export class ResourceStore {
 6 │     @observable accessor resources: Map<string, Decimal> = new Map();

Where the code is really simple:

export class ResourceStore {
    @observable accessor resources: Map<string, Decimal> = new Map();
}

tsconfig is set like:

{
  "compilerOptions": {
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "strict": true,
    "noEmit": true,
    "esModuleInterop": true,
    "module": "esnext",
    "moduleResolution": "bundler",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve",
    "incremental": true,
    "target": "es2015",
    "plugins": [
      {
        "name": "next"
      }
    ],
    "paths": {
      "@/*": ["./src/*"]
    }
  },
  "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
  "exclude": ["node_modules"]
}

Does typescript (nextjs?) not support modern javascript decorators? Or which target should I aim for?


I see the smae problem even when I set the target to es2022 and use node 21