Add prettier config, format codebase

This commit is contained in:
David Haz
2025-07-12 11:59:33 +03:00
parent ac8b2c04d8
commit f4d97ee94e
211 changed files with 10586 additions and 8810 deletions

View File

@@ -1,18 +1,18 @@
import { ref } from 'vue'
import { ref } from 'vue';
/**
* Composable for force re-rendering components
* Useful for demo components that need to restart animations or reset state
*/
export function useForceRerender() {
const rerenderKey = ref(0)
const rerenderKey = ref(0);
const forceRerender = () => {
rerenderKey.value++
}
rerenderKey.value++;
};
return {
rerenderKey,
forceRerender
}
};
}

View File

@@ -1,48 +1,51 @@
import { ref, onMounted } from 'vue'
import { getStarsCount } from '@/utils/utils'
import { ref, onMounted } from 'vue';
import { getStarsCount } from '@/utils/utils';
const CACHE_KEY = 'github_stars_cache'
const CACHE_DURATION = 24 * 60 * 60 * 1000
const CACHE_KEY = 'github_stars_cache';
const CACHE_DURATION = 24 * 60 * 60 * 1000;
export function useStars() {
const stars = ref<number>(0)
const stars = ref<number>(0);
const fetchStars = async () => {
try {
const cachedData = localStorage.getItem(CACHE_KEY)
const cachedData = localStorage.getItem(CACHE_KEY);
if (cachedData) {
const { count, timestamp } = JSON.parse(cachedData)
const now = Date.now()
const { count, timestamp } = JSON.parse(cachedData);
const now = Date.now();
if (now - timestamp < CACHE_DURATION) {
stars.value = count
return
stars.value = count;
return;
}
}
const count = await getStarsCount()
localStorage.setItem(CACHE_KEY, JSON.stringify({
count,
timestamp: Date.now()
}))
stars.value = count
const count = await getStarsCount();
localStorage.setItem(
CACHE_KEY,
JSON.stringify({
count,
timestamp: Date.now()
})
);
stars.value = count;
} catch (error) {
console.error('Error fetching stars:', error)
const cachedData = localStorage.getItem(CACHE_KEY)
console.error('Error fetching stars:', error);
const cachedData = localStorage.getItem(CACHE_KEY);
if (cachedData) {
const { count } = JSON.parse(cachedData)
stars.value = count
const { count } = JSON.parse(cachedData);
stars.value = count;
}
}
}
};
onMounted(() => {
fetchStars()
})
fetchStars();
});
return stars
return stars;
}