Compare commits

..

2 Commits

Author SHA1 Message Date
Viktor Rådberg
969b4f01ff fix analytics 2025-11-17 23:40:13 +01:00
Viktor Rådberg
d5aa60f0b3 fix extra counter direction (#52) 2025-11-17 22:48:40 +01:00
3 changed files with 27 additions and 12 deletions

View File

@@ -1,11 +1,7 @@
{
"hosting": {
"public": "dist",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"rewrites": [
{
"source": "**",

View File

@@ -19,10 +19,10 @@ const Container = twc.div<RotationDivProps>((props) => [
]);
export const ExtraCountersGrid = twc.div<RotationDivProps>((props) => [
'flex absolute flex-row flex-grow pointer-events-none overflow-x-scroll overflow-y-hidden ',
'flex absolute flex-grow pointer-events-none',
props.$rotation === Rotation.SideFlipped || props.$rotation === Rotation.Side
? 'flex-col-reverse h-full w-auto bottom-auto right-0'
: 'w-full bottom-0',
? 'flex-col h-full w-auto overflow-y-scroll overflow-x-hidden bottom-auto right-0'
: 'flex-row w-full overflow-x-scroll overflow-y-hidden bottom-0',
]);
type ExtraCountersBarProps = {

View File

@@ -1,17 +1,30 @@
import { initializeApp } from 'firebase/app';
import { getAnalytics, logEvent } from 'firebase/analytics';
import { Analytics, getAnalytics, logEvent } from 'firebase/analytics';
const firebaseConfig = {
apiKey: 'AIzaSyCZ1AHMb5zmWS4VoRnC-OBxTswUfrJ0mlY',
authDomain: 'life-trinket.firebaseapp.com',
projectId: 'life-trinket',
storageBucket: 'life-trinket.appspot.com',
storageBucket: 'life-trinket.firebasestorage.app',
messagingSenderId: '508011650619',
appId: '1:508011650619:web:bdc7d0b6f8707b1f9e861e',
measurementId: 'G-BE86QSSG14',
};
const app = initializeApp(firebaseConfig);
const analytics = getAnalytics(app);
let analytics: Analytics | null = null;
const getAnalyticsInstance = () => {
if (!analytics) {
try {
analytics = getAnalytics(app);
} catch (error) {
console.error('Failed to initialize Firebase Analytics:', error);
return null;
}
}
return analytics;
};
export const useAnalytics = () => {
const trackEvent = (
@@ -23,12 +36,18 @@ export const useAnalytics = () => {
return;
}
const analyticsInstance = getAnalyticsInstance();
if (!analyticsInstance) {
console.warn('Analytics not available');
return;
}
const paramsWithVersion = {
...eventParams,
app_version: import.meta.env.VITE_APP_VERSION,
};
logEvent(analytics, eventName, paramsWithVersion);
logEvent(analyticsInstance, eventName, paramsWithVersion);
};
return { trackEvent };