mirror of
https://github.com/supabase/supabase.git
synced 2026-10-16 06:39:09 +03:00
* Move all studio files from /studio to /apps/studio. * Move studio specific prettier ignores. * Fix the ui references from studio. * Fix the css imports. * Fix all package.json issues. * Fix the prettier setup for the studio app. * Add .turbo folder to prettierignore. * Fix the github workflows.
48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
import { useParams } from 'common'
|
|
import { observer } from 'mobx-react-lite'
|
|
import { IconAlertCircle, IconLoader } from 'ui'
|
|
|
|
import { NewProjectPanel } from 'components/interfaces/Home'
|
|
import InformationBox from 'components/ui/InformationBox'
|
|
import ProjectUsage from './ProjectUsage'
|
|
import { useProjectLogRequestsCountQuery } from 'data/analytics/project-log-requests-count-query'
|
|
|
|
const ProjectUsageSection = observer(() => {
|
|
const { ref: projectRef } = useParams()
|
|
const {
|
|
data: usage,
|
|
error: usageError,
|
|
isLoading,
|
|
} = useProjectLogRequestsCountQuery({ projectRef })
|
|
|
|
if (usageError) {
|
|
return (
|
|
<InformationBox
|
|
hideCollapse
|
|
defaultVisibility
|
|
icon={<IconAlertCircle strokeWidth={2} />}
|
|
title="There was an issue loading the usage details of your project"
|
|
/>
|
|
)
|
|
}
|
|
|
|
const hasProjectData =
|
|
usage?.result && usage.result.length > 0 ? usage.result[0].count > 0 : false
|
|
|
|
return (
|
|
<>
|
|
{isLoading ? (
|
|
<div className="flex w-full items-center justify-center space-x-2">
|
|
<IconLoader className="animate-spin" size={14} />
|
|
<p className="text-sm">Retrieving project usage statistics</p>
|
|
</div>
|
|
) : hasProjectData ? (
|
|
<ProjectUsage />
|
|
) : (
|
|
<NewProjectPanel />
|
|
)}
|
|
</>
|
|
)
|
|
})
|
|
export default ProjectUsageSection
|