diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b878603..6a758fb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/). +## 0.7.0-rc +- Improve Settings page UI +- Add Theme support +- Add Slate theme +- Add Midnight theme +- Add Bumblebee theme +- Remove User email prompt + ## 0.6.0 - Modify UI to use stats-rings - Add Analytics provider diff --git a/src/api/client.ts b/src/api/client.ts deleted file mode 100644 index 27fbadd8..00000000 --- a/src/api/client.ts +++ /dev/null @@ -1,17 +0,0 @@ -import Pocketbase from "pocketbase"; -import { CreateAppUserInput, User } from "@/api/types"; - -// TODO: FIX THIS -// const api = new Pocketbase(import.meta.env.VITE_API_URL); - -const api = new Pocketbase("https://api.pachtop.com"); - -export const createAppUser = async (input: CreateAppUserInput) => { - const appUser = await api.collection("app_users").create(input); // Add type - return appUser; -}; - -export const updateAppUser = async (id: string, input: Partial) => { - const appUser = await api.collection("app_users").update(id, { id, ...input }); - return appUser; -}; diff --git a/src/api/index.ts b/src/api/index.ts deleted file mode 100644 index a2df82da..00000000 --- a/src/api/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from "@/api/client"; -export * from "@/api/types"; diff --git a/src/api/types.ts b/src/api/types.ts deleted file mode 100644 index 64f4ed0f..00000000 --- a/src/api/types.ts +++ /dev/null @@ -1,11 +0,0 @@ -export interface User { - id: string; - email: string; - first_name: string; - last_name: string; - last_active: Date; - opt_in: boolean; - operating_system: string; - version: string; -} -export type CreateAppUserInput = Omit; diff --git a/src/lib/store.ts b/src/lib/store.ts index a174d61c..8741c3a4 100644 --- a/src/lib/store.ts +++ b/src/lib/store.ts @@ -1,5 +1,6 @@ import { Store } from "tauri-plugin-store"; +// Currently not being used, implement on PostHog maybe? const userId = (store: Store) => { return { get: async () => await store.get("userId"), diff --git a/src/providers/index.tsx b/src/providers/index.tsx index 8c2ea877..e001f398 100644 --- a/src/providers/index.tsx +++ b/src/providers/index.tsx @@ -1,4 +1,3 @@ -import UserProvider from "@/providers/user.provider"; import ThemeProvider from "@/providers/theme.provider"; import ServerEventsProvider from "@/providers/server-events.provider"; import AnalyticsProvider from "@/providers/analytics.provider"; @@ -15,10 +14,8 @@ const AppProvider: React.FC = ({ children }) => { - - - {children} - + + {children} diff --git a/src/providers/user.provider.tsx b/src/providers/user.provider.tsx deleted file mode 100644 index 74714fd8..00000000 --- a/src/providers/user.provider.tsx +++ /dev/null @@ -1,125 +0,0 @@ -import { createContext, useCallback, useEffect, useState } from "react"; -import { useDisclosure } from "@mantine/hooks"; -import { Modal, Title, Text, Center, Stack, TextInput, Button, Space } from "@mantine/core"; -import { useForm } from "@mantine/form"; -import { CreateAppUserInput, createAppUser, updateAppUser } from "@/api"; -import store from "@/lib/store"; -import useServerEventsContext from "@/hooks/useServerEventsContext"; -import { getVersion } from "@tauri-apps/api/app"; -import useEffectAsync from "../hooks/useEffectAsync"; - -interface UserProviderProps { - children: React.ReactNode; -} - -interface UserProviderContext {} - -const UserContext = createContext({}); - -//TODO: Move this somewhere else? - -const initialValues: CreateAppUserInput = { - email: "", - first_name: "", - last_name: "", - last_active: new Date(), - operating_system: "", - opt_in: true, - version: "", -}; - -const UserProvider: React.FC = ({ children }) => { - const { sysInfo } = useServerEventsContext(); - const [opened, { open, close }] = useDisclosure(false); - - const form = useForm({ - initialValues, - validate: { - email: (value) => (/^\S+@\S+$/.test(value) ? null : "Invalid email"), - }, - }); - - useEffectAsync(async () => {}, [sysInfo?.osVersion]); - - useEffectAsync(async () => { - const version = await getVersion(); - const id = await store.userId.get(); - - if (!id) { - open(); - return; - } - - if (!sysInfo?.osVersion) return; - - await updateAppUser(id, { - last_active: new Date(), - operating_system: sysInfo?.osVersion, - version, - }); - }, [sysInfo?.osVersion]); - - const createAndSetUserId = async (values: CreateAppUserInput, opt_in = true) => { - const version = await getVersion(); - const user = await createAppUser({ - ...values, - operating_system: sysInfo?.osVersion ?? "Not Available", - last_active: new Date(), - opt_in, - version, - }); - await store.userId.set(user.id); - }; - - const handleSubmitForm = async (values: CreateAppUserInput) => { - close(); - await createAndSetUserId(values); - }; - - const handleSkipForm = async (values: CreateAppUserInput) => { - close(); - await createAndSetUserId(values, false); - }; - - return ( - - {}} size="lg" withCloseButton={false}> -
-
- - Welcome 👋 - - We'd love to know who you are! We're using this information to learn more about early users, and we - might send you an email to let you know when the full version of the app is released. Pachtop will - always be an Open Source and free project. - - - - - - - - - - -
-
-
- {children} -
- ); -}; - -export default UserProvider;