mirror of
https://github.com/Radiquum/AniX.git
synced 2025-04-30 01:49:40 +05:00
feat: add analytics
This commit is contained in:
parent
33d34938c6
commit
6d4d320da8
9 changed files with 67 additions and 15 deletions
|
@ -7,6 +7,7 @@ import { useEffect, useState } from "react";
|
|||
import { Button, Modal } from "flowbite-react";
|
||||
import { Spinner } from "./components/Spinner/Spinner";
|
||||
import { ChangelogModal } from "#/components/ChangelogModal/ChangelogModal";
|
||||
import PlausibleProvider from "next-plausible";
|
||||
|
||||
const inter = Inter({ subsets: ["latin"] });
|
||||
|
||||
|
@ -97,6 +98,14 @@ export const App = (props) => {
|
|||
</Button>
|
||||
</Modal.Footer>
|
||||
</Modal>
|
||||
{preferencesStore.flags.enableAnalytics && (
|
||||
<PlausibleProvider
|
||||
domain="anix.wah.su"
|
||||
trackLocalhost={true}
|
||||
selfHosted={true}
|
||||
enabled={true}
|
||||
/>
|
||||
)}
|
||||
</body>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -310,6 +310,34 @@ const SettingsModal = (props: { isOpen: boolean; setIsOpen: any }) => {
|
|||
checked={preferenceStore.flags.showChangelog}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<p className="font-bold dark:text-white">
|
||||
Отправка аналитики
|
||||
</p>
|
||||
<p className="text-gray-500 dark:text-gray-400">
|
||||
Требуется перезагрузка для применения
|
||||
</p>
|
||||
</div>
|
||||
<ToggleSwitch
|
||||
color="blue"
|
||||
theme={{
|
||||
toggle: {
|
||||
checked: {
|
||||
color: {
|
||||
blue: "border-blue-700 bg-blue-700",
|
||||
},
|
||||
},
|
||||
},
|
||||
}}
|
||||
onChange={() =>
|
||||
preferenceStore.setFlags({
|
||||
enableAnalytics: !preferenceStore.flags.enableAnalytics,
|
||||
})
|
||||
}
|
||||
checked={preferenceStore.flags.enableAnalytics}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</Modal.Body>
|
||||
</Modal>
|
||||
|
|
|
@ -9,6 +9,7 @@ interface preferencesState {
|
|||
// saveSearchHistory: boolean;
|
||||
saveWatchHistory?: boolean;
|
||||
showChangelog?: boolean;
|
||||
enableAnalytics?: boolean;
|
||||
};
|
||||
params: {
|
||||
isFirstLaunch?: boolean;
|
||||
|
@ -32,6 +33,7 @@ export const usePreferencesStore = create<preferencesState>()(
|
|||
// saveSearchHistory: true,
|
||||
saveWatchHistory: true,
|
||||
showChangelog: true,
|
||||
enableAnalytics: true,
|
||||
},
|
||||
params: {
|
||||
isFirstLaunch: true,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue