The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Delete discussions route
Terry Sutton4b7462988ec3
diff --git a/apps/temp-docs/layouts/Default.tsx b/apps/temp-docs/layouts/Default.tsxindex 30c595403e7..7b56cd610d2 100644--- a/apps/temp-docs/layouts/Default.tsx+++ b/apps/temp-docs/layouts/Default.tsx@@ -12,7 +12,7 @@ const Layout = ({currentPage,}: {meta: { title: string; description: string; hide_table_of_contents?: boolean }- children: JSX.Element+ children: anytoc?: anymenuItems: anycurrentPage: stringdiff --git a/apps/temp-docs/pages/discussions/[id].tsx b/apps/temp-docs/pages/discussions/[id].tsxdeleted file mode 100644index 4e05cecb31e..00000000000--- a/apps/temp-docs/pages/discussions/[id].tsx+++ /dev/null@@ -1,287 +0,0 @@-import { ApolloClient, createHttpLink, InMemoryCache, gql } from '@apollo/client'-import { setContext } from '@apollo/client/link/context'-import Layout from '../../layouts/Default'-import { IconArrowLeft, Badge, Button, IconArrowUp, IconCheck } from 'ui'-import ReactMarkdown from 'react-markdown'-import Image from 'next/image'-import Link from 'next/link'--export async function getServerSideProps(context: any) {- const prams = context.params-- const httpLink = createHttpLink({- uri: 'https://api.github.com/graphql',- })-- const authLink = setContext((_, { Headers }) => {- return {- headers: {- Headers,- authorization: `Bearer ${process.env.GITHUB_ACCESS_TOKEN}`,- },- }- })-- const client = new ApolloClient({- link: authLink.concat(httpLink),- cache: new InMemoryCache(),- })-- const { data } = await client.query({- query: gql`- {- repository(owner: "supabase", name: "supabase") {- discussion(number: ${prams!.id}) {- id- number- title- upvoteCount- body- createdAt- answer {- isAnswer- }- author {- url- login- avatarUrl- }- category {- name- }- comments(first: 10) {- totalCount- nodes {- id- isAnswer- replies(first: 10) {- nodes {- author {- avatarUrl- login- url- }- body- createdAt- }- totalCount- }- author {- avatarUrl- login- url- }- body- createdAt- upvoteCount- }- }- }- }- }- `,- })-- return {- props: {- data,- prams,- },- }-}--const discussion = ({ data, prams }: any) => {- const meta_description = 'Discuss Supabase with other developers and users.'-- const getTimeSinceCreated = (createdAt: string) => {- const date = new Date(createdAt)- const now = new Date()- const timeSinceCreated = now.getTime() - date.getTime()- const days = Math.floor(timeSinceCreated / (1000 * 60 * 60 * 24))- const hours = Math.floor((timeSinceCreated % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))- const minutes = Math.floor((timeSinceCreated % (1000 * 60 * 60)) / (1000 * 60))- const seconds = Math.floor((timeSinceCreated % (1000 * 60)) / 1000)-- if (days < 7) {- if (days > 1) {- return `${days} days ago`- } else {- if (hours > 1) {- return `${hours} hours ago`- } else {- if (minutes > 1) {- return `${minutes} minutes ago`- } else {- return `${seconds} seconds ago`- }- }- }- } else {- return date.toLocaleDateString('en-US', {- month: 'short',- day: 'numeric',- year: 'numeric',- })- }- }-- return (- <Layout- meta={{- title: data.repository.discussion.title,- description: meta_description,- }}- currentPage={'Discussions'}- >- <div className="my-8 space-y-8">- <div>- <div className="flex justify-between">- <Link href="/discussions">- <a className="text-scale-1100 group flex w-fit items-center text-sm">- <IconArrowLeft- className="stroke-2 transition group-hover:-translate-x-1"- height={15}- />- Go Back- </a>- </Link>- <Link href={`https://github.com/supabase/supabase/discussions/${prams.id}`}>- <a target="_blank">- <Button className="text-base text-white">Open in Github</Button>- </a>- </Link>- </div>- <div className="mt-3 flex items-center text-3xl">- <span>{data.repository.discussion.title}</span>- <span className="text-scale-1000 ml-1">#{data.repository.discussion.number}</span>- </div>- <div className="text-scale-1100 mt-1 flex items-center space-x-2">- <Badge color={data.repository.discussion.answer?.isAnswer ? 'green' : 'gray'}>- {data.repository.discussion.answer?.isAnswer ? 'Answered' : 'Unanswered'}- </Badge>- <span>- <Link href={data.repository.discussion.author.url}>- <a target="_blank">{data.repository.discussion.author.login}</a>- </Link>- {` started this conversation in ${data.repository.discussion.category.name}`}- </span>- </div>- </div>- <div className="bg-scale-400 border-scale-600 space-y-4 rounded-lg border px-6 py-4">- <div className="flex items-center">- <Link href={data.repository.discussion.author.url}>- <a target="_blank" className="flex items-center">- <Image- className="rounded-full"- src={data.repository.discussion.author.avatarUrl}- width={30}- height={30}- />- <span className="ml-2">{data.repository.discussion.author.login}</span>- </a>- </Link>- <span className="text-scale-1100 ml-2">{`on ${getTimeSinceCreated(- data.repository.discussion.createdAt- )}`}</span>- </div>- <div className="mt-4">- <ReactMarkdown>{data.repository.discussion.body}</ReactMarkdown>- </div>- <div className="item-center bg-scale-400 border-scale-600 flex h-fit w-fit items-center space-x-1 rounded-xl border py-1 pl-1 pr-2">- <IconArrowUp className="stroke-2" height={10} />- <span className="text-sm">{data.repository.discussion.upvoteCount}</span>- </div>- </div>- <div>{`${data.repository.discussion.comments.totalCount} comments`}</div>- <div className="space-y-8">- {data.repository.discussion.comments.nodes.map((comment: any) => {- return (- <div key={comment.id}>- <div- className={`bg-scale-400 space-y-4 border px-6 py-4 ${- comment.replies.totalCount > 0 ? 'rounded-t-lg' : 'rounded-lg'- } ${comment.isAnswer === true ? 'border-brand-900' : 'border-scale-600'}`}- >- <div className="flex items-center">- <Link href={comment.author.url}>- <a target="_blank" className="flex items-center">- <Image- className="rounded-full"- src={comment.author.avatarUrl}- width={30}- height={30}- />- <span className="ml-2">{comment.author.login}</span>- </a>- </Link>- <span className="text-scale-1100 ml-2">{`on ${getTimeSinceCreated(- comment.createdAt- )}`}</span>- </div>- <div>- <ReactMarkdown>{comment.body}</ReactMarkdown>- </div>- <div className="flex items-center space-x-2">- {comment.isAnswer === true && (- <div className="bg-brand-900 rounded-full px-1.5 py-2 text-white">- <IconCheck className="stroke-2" height={15} />- </div>- )}- <div className="item-center bg-scale-400 border-scale-600 flex h-fit items-center space-x-1 rounded-xl border py-1 pl-1 pr-2">- <IconArrowUp className="stroke-2" height={10} />- <span className="text-sm">{comment.upvoteCount}</span>- </div>- </div>- </div>- {comment.replies.totalCount > 0 && (- <div className="border-scale-600 bg-scale-100 space-y-4 rounded-b-lg border p-4">- {comment.replies.nodes.map((reply: any, i: number) => {- const lastReply = i === comment.replies.nodes.length - 1- return (- <div- className={`space-y-4 pb-4 ${- lastReply === true ? null : 'border-scale-600 border-b'- }`}- key={i}- >- <div className="flex items-center">- <Link href={reply.author.url}>- <a target="_blank" className="flex items-center">- <Image- className="rounded-full"- src={reply.author.avatarUrl}- width={30}- height={30}- />- <span className="ml-2">{reply.author.login}</span>- </a>- </Link>- <span className="text-scale-1100 ml-2">{`on ${getTimeSinceCreated(- reply.createdAt- )}`}</span>- </div>- <div>- <ReactMarkdown>{reply.body}</ReactMarkdown>- </div>- </div>- )- })}- </div>- )}- </div>- )- })}- </div>- <div className="mt-8">- <Link href={`https://github.com/supabase/supabase/discussions/${prams.id}`}>- <a target="_blank">- <Button className="text-base text-white">comment on Github</Button>- </a>- </Link>- </div>- </div>- </Layout>- )-}--export default discussiondiff --git a/apps/temp-docs/pages/discussions/index.tsx b/apps/temp-docs/pages/discussions/index.tsxdeleted file mode 100644index 59aa403337d..00000000000--- a/apps/temp-docs/pages/discussions/index.tsx+++ /dev/null@@ -1,273 +0,0 @@-import { ApolloClient, createHttpLink, InMemoryCache, gql } from '@apollo/client'-import { setContext } from '@apollo/client/link/context'-import Layout from '../../layouts/Default'-import { IconArrowUp, IconCheckCircle } from 'ui'-import Image from 'next/image'-import Link from 'next/link'-import Pagination from '../../components/pagination'--export async function getServerSideProps(context: { query: { page: number } }) {- const Page: any = context.query?.page || 1- const page: number = parseInt(Page)-- const httpLink = createHttpLink({- uri: 'https://api.github.com/graphql',- })-- const authLink = setContext((_, { Headers }) => {- return {- headers: {- Headers,- authorization: `Bearer ${process.env.GITHUB_ACCESS_TOKEN}`,- },- }- })-- const client = new ApolloClient({- link: authLink.concat(httpLink),- cache: new InMemoryCache(),- })-- const { data } = await client.query({- query: gql`- {- repository(owner: "supabase", name: "supabase") {- pinnedDiscussions(first: 3) {- edges {- node {- id- discussion {- id- number- title- author {- url- avatarUrl- login- }- category {- id- emoji- name- }- }- }- }- totalCount- }- discussions(first: ${page}0) {- nodes {- id- number- createdAt- upvoteCount- title- body- comments(first: 3) {- totalCount- nodes {- id- author {- avatarUrl- login- }- }- }- category {- id- name- emoji- }- author {- login- url- avatarUrl- }- answer {- isAnswer- author {- avatarUrl- login- }- }- }- totalCount- }- }- }- `,- })-- return {- props: {- data,- page,- },- }-}--const discussions = ({ data, page }: { data: any; page: number }) => {- const meta_title = 'Discussions'- const meta_description = 'Discuss Supabase with other developers and users.'-- // TODO: This was a quick hack to show emojis in discussions. should be replaced with a proper solution.- const emojiInput = [':zap:', ':ship:', ':bulb:', ':question:', ':raised_hands:']- const emojiOutput = ['⚡️', '🚢', '💡', '❓', '🙌']-- const getEmoji = (category: string) => {- const index = emojiInput.indexOf(category)- return emojiOutput[index]- }-- const getTimeSinceCreated = (createdAt: string) => {- const date = new Date(createdAt)- const now = new Date()- const timeSinceCreated = now.getTime() - date.getTime()- const days = Math.floor(timeSinceCreated / (1000 * 60 * 60 * 24))- const hours = Math.floor((timeSinceCreated % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))- const minutes = Math.floor((timeSinceCreated % (1000 * 60 * 60)) / (1000 * 60))- const seconds = Math.floor((timeSinceCreated % (1000 * 60)) / 1000)-- if (days < 7) {- if (days > 1) {- return `${days} days ago`- } else {- if (hours > 1) {- return `${hours} hours ago`- } else {- if (minutes > 1) {- return `${minutes} minutes ago`- } else {- return `${seconds} seconds ago`- }- }- }- } else {- return date.toLocaleDateString('en-US', {- month: 'short',- day: 'numeric',- year: 'numeric',- })- }- }-- return (- <Layout meta={{ title: meta_title, description: meta_description }} currentPage={'Discussions'}>- <div className="mb-16 space-y-8">- <div className="mt-4 flex items-center justify-between">- <h2 className="text-3xl md:text-4xl">Discussions</h2>- <Link href="https://github.com/supabase/supabase/discussions/new">- <a- target="_blank"- className="rounded-lg bg-[#34b17b] px-4 py-2 text-xs text-white transition duration-150 hover:bg-[#40cf8e] md:text-sm"- >- New Discussion- </a>- </Link>- </div>- <div className="justify-around space-y-4 md:flex md:space-y-0 md:space-x-4">- {data.repository.pinnedDiscussions.edges.map((discussion: any) => {- const item = discussion.node- return (- <div- className="border-scale-600 bg-scale-400 rounded-xl border px-4 py-4 md:w-1/3"- key={item.id}- >- <Link href={`/discussions/${item.discussion.number}`}>- <a className="space-y-4">- <div className="flex justify-end text-2xl">- {getEmoji(item.discussion.category.emoji)}- </div>- <div>- <p className="text-sm font-normal">{item.discussion.category.name}</p>- <h2 className="max-w-[350px] truncate text-xl font-semibold">- {item.discussion.title}- </h2>- </div>- <Link href={item.discussion.author.url}>- <a className="flex w-fit items-center space-x-2">- <Image- className="rounded-full"- src={item.discussion.author.avatarUrl}- height={30}- width={30}- />- <span className="text-sm">{item.discussion.author.login}</span>- </a>- </Link>- </a>- </Link>- </div>- )- })}- </div>- <div className="space-y-6">- {data.repository.discussions.nodes- .slice(page * 10 - 10, page * 10)- .map((discussion: any) => {- return (- <div className="border-scale-600 border-b pb-6 md:pb-0" key={discussion.id}>- <Link href={`/discussions/${discussion.number}`}>- <a className="mb-6 items-center justify-between md:mx-6 md:flex">- <div className="flex items-center">- <div className="item-center flex items-center md:space-x-6">- <div className="item-center bg-scale-400 border-scale-600 hidden h-fit items-center space-x-1 rounded-xl border py-1 pl-1 pr-2 md:flex">- <IconArrowUp className="stroke-2" height={15} />- <span>{discussion.upvoteCount}</span>- </div>- <div className="rounded-lg bg-gray-400 px-3 py-2 md:px-5 md:py-4">- {getEmoji(discussion.category.emoji)}- </div>- </div>- <div className="ml-6">- <h2 className="text-base font-semibold md:max-w-sm md:text-lg lg:max-w-4xl">- {discussion.title}- </h2>- <span className="text-scale-1000 text-xs">- <Link href={discussion.author.url}>- <a>{discussion.author.login}</a>- </Link>- <span>{` asked ${getTimeSinceCreated(discussion.createdAt)} • `}</span>- <span className={discussion.answer?.isAnswer ? 'text-brand-900' : ''}>- {discussion.answer?.isAnswer ? 'Answered' : 'Unanswered'}- </span>- </span>- </div>- </div>- <div className="ml-16 mt-2 flex items-center space-x-2 md:ml-0 md:mt-0">- <div className="flex items-center -space-x-2">- <Link href={discussion.author.url}>- <a>- <Image- className="rounded-full"- src={discussion.author.avatarUrl}- height={30}- width={30}- />- </a>- </Link>- </div>- <div- className={`item-center flex items-center space-x-1 ${- discussion.answer?.isAnswer ? 'text-brand-900' : ''- }`}- >- <IconCheckCircle className="stroke-2" height={15} />- <span>{discussion.comments.totalCount}</span>- </div>- </div>- </a>- </Link>- </div>- )- })}- </div>- <div>- <Pagination currentPage={page} totalCount={data.repository.discussions.totalCount} />- </div>- </div>- </Layout>- )-}--export default discussionsdiff --git a/apps/www/public/sitemap_www.xml b/apps/www/public/sitemap_www.xmlindex ea0a6a2d4e0..16014f465f9 100644--- a/apps/www/public/sitemap_www.xml+++ b/apps/www/public/sitemap_www.xml@@ -54,6 +54,12 @@<changefreq>0.5</changefreq></url>+ <url>+ <loc>https://supabase.com/blog/</loc>+ <changefreq>weekly</changefreq>+ <changefreq>0.5</changefreq>+ </url>+<url><loc>https://supabase.com/contact/enterprise</loc><changefreq>weekly</changefreq>@@ -85,13 +91,13 @@</url><url>- <loc>https://supabase.com/nextjs/Nextjs</loc>+ <loc>https://supabase.com/legal/soc2</loc><changefreq>weekly</changefreq><changefreq>0.5</changefreq></url><url>- <loc>https://supabase.com/blog/</loc>+ <loc>https://supabase.com/nextjs/Nextjs</loc><changefreq>weekly</changefreq><changefreq>0.5</changefreq></url>@@ -834,6 +840,36 @@<changefreq>0.5</changefreq></url>+ <url>+ <loc>https://supabase.com/blog/postgres-wasm</loc>+ <changefreq>weekly</changefreq>+ <changefreq>0.5</changefreq>+ </url>++ <url>+ <loc>https://supabase.com/blog/supabase-beta-update-september-2022</loc>+ <changefreq>weekly</changefreq>+ <changefreq>0.5</changefreq>+ </url>++ <url>+ <loc>https://supabase.com/blog/postgres-full-text-search-vs-the-rest</loc>+ <changefreq>weekly</changefreq>+ <changefreq>0.5</changefreq>+ </url>++ <url>+ <loc>https://supabase.com/blog/supabase-js-v2-released</loc>+ <changefreq>weekly</changefreq>+ <changefreq>0.5</changefreq>+ </url>++ <url>+ <loc>https://supabase.com/blog/supabase-flutter-sdk-v1-released</loc>+ <changefreq>weekly</changefreq>+ <changefreq>0.5</changefreq>+ </url>+<url><loc>https://supabase.com/alternatives/supabase-vs-firebase</loc><changefreq>weekly</changefreq>