Skip to content

Commit 8e51072

Browse files
authored
Merge pull request #503 from zirreal/master
updated books load a bit + small layout fix
2 parents f1a6dcc + 7402d5f commit 8e51072

File tree

3 files changed

+28
-13
lines changed

3 files changed

+28
-13
lines changed

src/components/books/BooksItem.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const { book, gateway } = Astro.props;
2626

2727
<script define:vars={{ book, gateway }}>
2828
const TIMEOUT_MS = 15_000;
29-
const MAX_CACHE_AGE = 7 * 24 * 3600 * 1_000;
29+
const MAX_CACHE_AGE = 3 * 24 * 3600 * 1_000;
3030

3131
const fetchGateway = async (url, timeout = TIMEOUT_MS) => {
3232
const controller = new AbortController();

src/components/header/HeaderNav.astro

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ import Socials from '../blocks/Socials.astro'
6464
position: fixed;
6565
right: 0;
6666
text-align: left;
67-
top: calc(var(--screen-padding-top) + 50px);
67+
top: calc(var(--screen-padding-top) + 44px);
6868
transform: translateX(-20px);
6969
z-index: 1012;
7070
}
@@ -173,8 +173,16 @@ import Socials from '../blocks/Socials.astro'
173173

174174
.nav-content {
175175
height: 100%;
176-
top: calc(var(--screen-padding-top) + 90px);
176+
top: calc(var(--screen-padding-top) + 44px);
177+
/* top: calc(var(--screen-padding-top) + 90px); */
177178
}
178179
}
179180

181+
@media screen and (max-width: 480px) {
182+
.nav-content {
183+
top: calc(var(--screen-padding-top) + 90px);
184+
}
185+
}
186+
187+
180188
</style>

src/pages/books.astro

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import RecommendationItem from '../components/books/RecommendationItem.astro';
88
import BooksFooter from '../components/books/BooksFooter.astro';
99
import Spinner from '../components/utils/LoaderSpin.vue';
1010
11-
12-
1311
const books = [
1412
{
1513
id:0,
@@ -165,6 +163,7 @@ const books = [
165163
]
166164
}
167165
];
166+
168167
const recs = [
169168
{
170169
title: $tr('The Nature of the Firm'),
@@ -221,22 +220,29 @@ const gateways = [
221220
'https://gw.crust-gateway.com/ipfs/',
222221
'https://gateway.pinata.cloud/ipfs/',
223222
'https://ipfs.io/ipfs/',
223+
'https://hardbin.com/ipfs/',
224+
'https://ipfs.eth.aragon.network/ipfs/',
225+
'https://nftstorage.link/ipfs/',
226+
'https://4everland.io/ipfs/',
227+
'https://w3s.link/ipfs/',
228+
'https://trustless-gateway.link/ipfs/'
224229
];
225230
226231
let bookGateway = null;
227232
228233
try {
229-
const res = await pingIPFS(gateways);
230-
console.log(res)
231-
if (res.ok) {
232-
bookGateway = gateway;
233-
console.log(res)
234+
const result = await pingIPFS(gateways);
235+
if (result) {
236+
bookGateway = result;
237+
console.log("✅ Selected IPFS Gateway:", bookGateway);
238+
} else {
239+
console.warn("⚠️ No working gateway found via pingIPFS(), using fallback.");
240+
bookGateway = 'https://gw.crust-gateway.xyz/ipfs/';
234241
}
235-
} catch {
236-
bookGateway = 'https://gw.crust-gateway.xyz/ipfs/';
242+
} catch (err) {
243+
console.error("❌ pingIPFS() failed, using fallback gateway. Error:", err);
237244
}
238245
239-
bookGateway = bookGateway ? bookGateway : 'https://gw.crust-gateway.xyz/ipfs/';
240246
---
241247

242248
<Layout
@@ -245,6 +251,7 @@ bookGateway = bookGateway ? bookGateway : 'https://gw.crust-gateway.xyz/ipfs/';
245251
pageTitle={$tr("Read books")}
246252
>
247253

254+
<p>Selected IPFS Gateway: {Astro.props.gateway}</p>
248255
<section class="layout layout__content e-books">
249256
<div class="layout__text books__abstract">
250257
<p>{$tr("We think reading books can really open up your mind. Whether it's simple but smart ideas or more complex ones, books are the best way for your brain to soak it all in. You can grab our books for free and check out our list of recommended reads to dive into the exciting world of robotics!")}</p>

0 commit comments

Comments
 (0)