Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

remove globe dependencies (#33033)

Saxon Fletcherd8b034ad69e3
diff --git a/apps/studio/components/interfaces/ProjectCreation/ProjectVisual.tsx b/apps/studio/components/interfaces/ProjectCreation/ProjectVisual.tsx
index a2bd9b7b8ea..ee5504c90e9 100644
--- a/apps/studio/components/interfaces/ProjectCreation/ProjectVisual.tsx
+++ b/apps/studio/components/interfaces/ProjectCreation/ProjectVisual.tsx
@@ -3,9 +3,7 @@ import { Box, Clock, Database, File, ListOrdered, User2, Zap } from 'lucide-reac
import { memo } from 'react'
import { SchemaVisualizer } from 'components/interfaces/SchemaVisualizer'
-import Globe from 'components/ui/Globe'
import { BASE_PATH } from 'lib/constants'
-import { AWS_REGIONS, FLY_REGIONS } from 'shared-data'
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from 'ui'
interface SupabaseService {
diff --git a/apps/studio/components/ui/Globe.tsx b/apps/studio/components/ui/Globe.tsx
deleted file mode 100644
index e2a3b7a0635..00000000000
--- a/apps/studio/components/ui/Globe.tsx
+++ /dev/null
@@ -1,103 +0,0 @@
-import createGlobe from 'cobe'
-import { debounce } from 'lodash'
-import { useTheme } from 'next-themes'
-import { useEffect, useRef } from 'react'
-
-interface GlobeProps {
- readonly markers?: [number, number][]
- readonly currentLocation?: [number, number]
-}
-
-const Globe = ({ markers, currentLocation }: GlobeProps) => {
- const { resolvedTheme } = useTheme()
- const canvasRef = useRef<any>()
- const locationToAngles = (lat: number, long: number) => {
- return [Math.PI - ((long * Math.PI) / 180 - Math.PI / 2), (lat * Math.PI) / 180 + 0.2]
- }
- const currentPhiRef = useRef(0)
- const currentThetaRef = useRef(0.3)
- const targetPhiRef = useRef(0)
- const targetThetaRef = useRef(0.3)
-
- useEffect(() => {
- if (currentLocation) {
- const [lat, long] = currentLocation
- const [targetPhi, targetTheta] = locationToAngles(lat, long)
- targetPhiRef.current = targetPhi
- targetThetaRef.current = targetTheta
- }
- }, [currentLocation])
-
- useEffect(() => {
- let width = 0
-
- const onResize = () => {
- if (canvasRef.current) {
- width = canvasRef.current.offsetWidth
- }
- }
- const debouncedResize = debounce(onResize, 10)
- window.addEventListener('resize', debouncedResize)
- onResize()
-
- const cobe = createGlobe(canvasRef.current, {
- devicePixelRatio: 2,
- width: width * 2,
- height: width * 2,
- phi: 0,
- theta: 0.3,
- dark: resolvedTheme?.includes('dark') ? 1 : 0,
- diffuse: 2,
- scale: 1,
- opacity: 1,
- mapSamples: 20000,
- mapBrightness: 4,
- baseColor: [255 / 255, 255 / 255, 255 / 255],
- markerColor: [62 / 255, 207 / 255, 142 / 255],
- glowColor: [150 / 255, 150 / 255, 150 / 255],
- markers:
- markers?.map((coords) => ({
- location: coords,
- size:
- currentLocation && coords[0] === currentLocation[0] && coords[1] === currentLocation[1]
- ? 0.1
- : 0.03,
- })) || [],
- onRender: (state) => {
- if (currentLocation) {
- const distPhiPositive =
- (targetPhiRef.current - currentPhiRef.current + Math.PI * 2) % (Math.PI * 2)
- const distPhiNegative =
- (currentPhiRef.current - targetPhiRef.current + Math.PI * 2) % (Math.PI * 2)
-
- if (distPhiPositive < distPhiNegative) {
- currentPhiRef.current += distPhiPositive * 0.03
- } else {
- currentPhiRef.current -= distPhiNegative * 0.03
- }
-
- currentThetaRef.current += (targetThetaRef.current - currentThetaRef.current) * 0.03
-
- state.phi = currentPhiRef.current
- state.theta = currentThetaRef.current
- } else {
- currentPhiRef.current += 0.002
- state.phi = currentPhiRef.current
- state.theta = currentThetaRef.current
- }
-
- state.width = width * 2
- state.height = width * 2
- },
- })
-
- return () => {
- window.removeEventListener('resize', debouncedResize)
- cobe.destroy()
- }
- }, [resolvedTheme, markers, currentLocation])
-
- return <canvas ref={canvasRef} className="absolute inset-0 w-full h-full" />
-}
-
-export default Globe
diff --git a/apps/studio/package.json b/apps/studio/package.json
index 0a83667b526..8f78273023b 100644
--- a/apps/studio/package.json
+++ b/apps/studio/package.json
@@ -53,7 +53,6 @@
"ai": "^3.4.33",
"ai-commands": "workspace:*",
"awesome-debounce-promise": "^2.1.0",
- "cobe": "^0.6.3",
"common": "workspace:*",
"common-tags": "^1.8.2",
"config": "workspace:*",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index d191d4bb654..06f48ca78eb 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -613,9 +613,6 @@ importers:
awesome-debounce-promise:
specifier: ^2.1.0
version: 2.1.0
- cobe:
- specifier: ^0.6.3
- version: 0.6.3
common:
specifier: workspace:*
version: link:../../packages/common