mirror of
https://github.com/supabase/supabase.git
synced 2026-10-14 13:49:09 +03:00
* Add queries and mutations for realtime channels. * Change the layout, add a link for policies and modal for creating a channel. * Add a page for policies. * Add templates for realtime tables. * Fix the spacing in the PolicyDetails component. Add better types. * Pass templateData to the template generating functions. * Various CSS fixes. * Add components for rendering the realtime policies page. * Fix the editing policy flow. * Fix refetching when adding or deleting policies. * Minor various fixes. * Remove an old console.log. * More fixes for templates. * Make the realtime policies open by default when clicking on realtime. * Update the realtime policy templates. * Use a dropdown button for the three types of policies. * Fix a copy-paste mistake. * Fix icons. * Fix the toast. * Clean up the previous components. * Clean up more unneeded code. * Remove templateData prop. * Remove unneeded queries and mutations. * More cleanup. * Reuse the components from the Auth Policies. * Minor fixes for the new components. * Add a feature flag for AuthZ. * Revert some changes. * Fix a build error. * Fix all definitions. * Fix an issue with copying large lines which from templates which are word-wrapped. * Addressed various comments by Joshen. * Revert the UI changes in the Policy Editor. * Update the template names. * Small style fix --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
Writing components
Where to create your components
- For components that declare the general structure and layout of a page:
/components/layouts/xxx
- For components that are tightly coupled to a specific interface:
/components/interfaces/xxx
- For components that are meant to be reusable across multiple pages:
/components/ui/xxx
- Note: We're gradually moving files out of the
to-be-cleanedfolder into the respective folders as we refactor
Component structure
- If a component has constants and utility methods that are tightly coupled to itself, keep them close to the component and enclose them in a folder with an
index.tsxas an entry point - Otherwise it can just be a file on its own
- For example:
-
components/ui - SampleComponentA - SampleComponentA.tsx - SampleComponentA.constants.ts - SampleComponentA.utils.ts - SampleComponentA.types.ts - index.ts - SampleComponentB.tsx
-
Template for building components
// Declare the prop types of your component
interface ComponentAProps {
sampleProp: string
}
// Name your component accordingly
const ComponentA = ({ sampleProp }: ComponentAProps) => {
return <div>ComponentA: {sampleProp}</div>
}
export default ComponentA