- {showAuthorImg && (
-
- {!authorimg && authorimg !== undefined && }
-
- )}
+ {showAuthorImg &&
+ (authorimglicense && authorimg ? (
+
+
+ {!authorimg && authorimg !== undefined && }
+
+
+ ) : (
+
+ {!authorimg && authorimg !== undefined && }
+
+ ))}
{author ? (
@@ -38,11 +43,6 @@ export default function AuthorInfo({
{authorOccupation && authorOccupation !== 'Unknown' && (
{authorOccupation}
)}
- {authorimglicense && (
-
- {trimmedLicense}
-
- )}
) : (
diff --git a/src/features/quote/hooks/useQuoteLoader.js b/src/features/quote/hooks/useQuoteLoader.js
index f3afdc61..96804e66 100644
--- a/src/features/quote/hooks/useQuoteLoader.js
+++ b/src/features/quote/hooks/useQuoteLoader.js
@@ -2,21 +2,13 @@ import { useCallback } from 'react';
import variables from 'config/variables';
import offline_quotes from '../offline_quotes.json';
import { shouldUpdateByFrequency, resetStartTime } from 'utils/frequencyManager';
-import { safeParseJSON } from 'utils/jsonStorage';
-import { useCachedFetch } from 'hooks/useCachedFetch';
import { QueueManager } from 'utils/backgroundQueue';
+import { fetchAuthorFromWikidata } from 'utils/wikidata/wikidataAuthorFetcher';
/**
* Custom hook for loading quote data from various sources
*/
export function useQuoteLoader(updateQuote) {
- // Initialize cache hook for author images
- const { fetchWithCache: fetchAuthorImage } = useCachedFetch({
- cacheKey: 'authorImageCache',
- timestampKey: 'authorImageCacheTimestamp',
- expiryDays: 7,
- });
-
const getAuthorLink = useCallback((author) => {
return localStorage.getItem('authorLink') === 'false' || author === 'Unknown'
? null
@@ -25,78 +17,75 @@ export function useQuoteLoader(updateQuote) {
.join('_')}`;
}, []);
+ /**
+ * Fetch author data from Wikidata (image, occupation, description, etc.)
+ * @param {string} author - Author name
+ * @returns {Promise