The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Refactor
Joshen Lim96ece6b4f84b
diff --git a/studio/components/interfaces/Authentication/Users/Users.utils.ts b/studio/components/interfaces/Authentication/Users/Users.utils.tsnew file mode 100644index 00000000000..97169ba4f03--- /dev/null+++ b/studio/components/interfaces/Authentication/Users/Users.utils.ts@@ -0,0 +1,24 @@+import { detectBrowser } from 'lib/helpers'++/**+ * Formats the user datetime string into a format that's+ * readable across browsers.+ * - Postgres: 2022-05-12 09:24:12.639463+00+ *+ * These are the acceptable formats that Joshen has experimented so far+ * - Chrome: 2022-05-12 09:24:12.639463+00 (No format required)+ * - Firefox: 2022-05-12 09:24:12.639463+00 (No format required)+ * - Safari: 2022-05-12T09:24:12.639463+00+ *+ * Note: I've only seen this issue on the Auth page, hence why keeping+ * this util here for now. But if it does happen elsewhere i'll bring it+ * to lib/helpers+ */+export const formatUserDateString = (dateString: string) => {+ const browser = detectBrowser()+ if (browser === 'Safari') {+ return dateString.replace(' ', 'T')+ } else {+ return dateString+ }+}diff --git a/studio/components/interfaces/Authentication/Users/UsersListItem.tsx b/studio/components/interfaces/Authentication/Users/UsersListItem.tsxindex 4e39ffd4e11..20a04448be1 100644--- a/studio/components/interfaces/Authentication/Users/UsersListItem.tsx+++ b/studio/components/interfaces/Authentication/Users/UsersListItem.tsx@@ -3,10 +3,10 @@ import { FC } from 'react'import { observer } from 'mobx-react-lite'import { Badge } from '@supabase/ui'-import { formatPgDateString } from 'lib/helpers'import Table from 'components/to-be-cleaned/Table'import SimpleCodeBlock from 'components/to-be-cleaned/SimpleCodeBlock'import UserDropdown from './UserDropdown'+import { formatUserDateString } from './Users.utils'interface Props {user: any@@ -14,8 +14,8 @@ interface Props {const UserListItem: FC<Props> = ({ user }) => {const isUserConfirmed = user.email_confirmed_at || user.phone_confirmed_at- const createdAt = formatPgDateString(user.created_at)- const lastSignedIn = formatPgDateString(user.last_sign_in_at)+ const createdAt = formatUserDateString(user.created_at)+ const lastSignedIn = formatUserDateString(user.last_sign_in_at)return (<Table.tr key={user.id}>diff --git a/studio/components/interfaces/Billing/Subscription/Subscription.tsx b/studio/components/interfaces/Billing/Subscription/Subscription.tsxindex dfc7de081a0..2c1dcb66f09 100644--- a/studio/components/interfaces/Billing/Subscription/Subscription.tsx+++ b/studio/components/interfaces/Billing/Subscription/Subscription.tsx@@ -37,9 +37,6 @@ const Subscription: FC<Props> = ({const { ui } = useStore()const isOrgOwner = ui.selectedOrganization?.is_owner- // const nativeBilling = useFlag('nativeBilling')- const subscriptionStats = useSubscriptionStats()-const isPayg = subscription?.tier.prod_id === STRIPE_PRODUCT_IDS.PAYGconst addOns = subscription?.addons ?? []const paid = subscription && subscription.tier.unit_amount > 0diff --git a/studio/lib/helpers.ts b/studio/lib/helpers.tsindex 48f737e7346..61462bf4aa3 100644--- a/studio/lib/helpers.ts+++ b/studio/lib/helpers.ts@@ -210,22 +210,3 @@ export const detectBrowser = () => {return 'Safari'}}--/**- * Formats a PG datetime string into a format that's- * readable across browsers.- * - Postgres: 2022-05-12 09:24:12.639463+00- *- * These are the acceptable formats that Joshen has experimented so far- * - Chrome: 2022-05-12 09:24:12.639463+00 (No format required)- * - Firefox: 2022-05-12 09:24:12.639463+00 (No format required)- * - Safari: 2022-05-12T09:24:12.639463+00- */-export const formatPgDateString = (dateString: string) => {- const browser = detectBrowser()- if (browser === 'Safari') {- return dateString.replace(' ', 'T')- } else {- return dateString- }-}