Skip to content

Commit 0e48c33

Browse files
authored
Merge pull request #10 from supabase-community/dt-tweaks-minor-fixes
2 parents 0987aca + afc9de6 commit 0e48c33

File tree

5 files changed

+46
-8
lines changed

5 files changed

+46
-8
lines changed

README.md

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ yarn workspace app dev
8585

8686
### Synchronize the GraphQL schema
8787

88-
Note: You need to call `graphql.rebuild_schema()` manually to synchronize the GraphQL schema with the SQL schema after altering the SQL schema.
88+
Note: You need to call `select graphql.rebuild_schema()` manually to synchronize the GraphQL schema with the SQL schema after altering the SQL schema.
8989

9090
#### Manage Schema with dbmate
9191

@@ -132,9 +132,9 @@ See: [`./graphql/schema/schema.graphql`](./graphql/schema/schema.graphql)
132132

133133
See: [`./graphql/queries/`](./graphql/queries/)
134134

135-
Use: `https://mvrfvzcivgabojxddwtk.supabase.co/rest/v1/rpc/graphql`
135+
Use: `https://mvrfvzcivgabojxddwtk.supabase.co/graphql/v1`
136136

137-
Note: Needs headers
137+
> Note: Needs headers
138138
139139
```
140140
@@ -143,6 +143,28 @@ apiKey: <supabase_anon_key>
143143
144144
```
145145

146+
## GraphiQL
147+
148+
GraphiQL is an in-browser IDE for writing, validating, and testing GraphQL queries.
149+
150+
Visit `http://localhost:3000/api/graphiql` for the [Yoga GraphiQL Playground](https://www.graphql-yoga.com/docs/features/graphiql) where you can experiment with queries and mutations.
151+
152+
> Note: Needs headers
153+
154+
```
155+
156+
Content-Type: application/json
157+
apiKey: <supabase_anon_key>
158+
159+
```
160+
161+
> Note: In order for the RLS policies authenticate you. you've have to pass an authorization header:
162+
163+
```
164+
authorization: Bearker <access_token>
165+
166+
```
167+
146168
### Ranked Feed
147169

148170
```gql

app/lib/comment-item.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { useMutation } from "urql";
66

77
import { Auth } from "@supabase/ui";
88
import { TrashIcon } from "@heroicons/react/outline";
9-
9+
import { CalendarIcon, UserIcon } from "./icons";
1010
import { DocumentType, gql } from "../gql";
1111
import { timeAgo } from "./time-ago";
1212

@@ -16,6 +16,7 @@ const CommentItem_CommentFragment = gql(/* GraphQL */ `
1616
message
1717
createdAt
1818
post {
19+
id
1920
title
2021
}
2122
profile {
@@ -63,10 +64,19 @@ export function CommentItem(props: {
6364
<div className="flex items-center justify-between">
6465
<h3 className="text-sm font-medium">
6566
<Link href={`/profile/${props.comment.profile?.id}`}>
66-
<a className="text-gray-800">{props.comment.profile?.username}</a>
67+
<a className="text-gray-800 hover:text-green-500">
68+
{props.comment.profile?.username}
69+
</a>
6770
</Link>
6871
</h3>
69-
<p className="text-sm text-gray-500">{createdAt}</p>
72+
<p className="text-sm text-gray-500">
73+
<Link href={`/item/${props.comment.post?.id}`}>
74+
<a className="text-gray-800 hover:text-green-500 inline-flex items-center text-sm">
75+
<CalendarIcon className="w-4 h-4 mr-1" />
76+
{createdAt}
77+
</a>
78+
</Link>
79+
</p>
7080
</div>
7181
<p className="text-sm text-gray-500">
7282
{props.comment.message}

app/lib/urql.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export function UrqlProvider(props: { children: React.ReactNode }) {
2020

2121
const [client] = React.useState(function createUrqlClient() {
2222
return createClient({
23-
url: `${process.env.NEXT_PUBLIC_SUPABASE_URL!}/rest/v1/rpc/graphql`,
23+
url: `${process.env.NEXT_PUBLIC_SUPABASE_URL!}/graphql/v1`,
2424
fetchOptions: function createFetchOptions() {
2525
return { headers: getHeaders() };
2626
},

app/pages/login.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from "react";
22
import type { NextPage } from "next";
3+
import Head from "next/head";
34
import { Auth } from "@supabase/ui";
45
import { useSupabaseClient } from "../lib/supabase";
56
import { useRouter } from "next/router";
@@ -23,6 +24,11 @@ const LogIn: NextPage = () => {
2324

2425
return (
2526
<Container>
27+
<Head>
28+
<title>supanews | Login</title>
29+
<meta name="description" content="Sign in to submit posts and vote." />
30+
<link rel="icon" href="/favicon.ico" />
31+
</Head>
2632
<MainSection>
2733
<div className="m-width-md mx-auto">
2834
<h1 className="font-semibold text-xl tracking-tight mb-5">Login</h1>

scripts/fetchGraphQLSchema.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ console.log(
5858
)
5959
);
6060

61-
fetchGraphQLSchema(`${process.env.SUPABASE_URL}/rest/v1/rpc/graphql`, {
61+
fetchGraphQLSchema(`${process.env.SUPABASE_URL}/graphql/v1`, {
6262
readable: true,
6363
}).then((schema) => {
6464
fs.writeFileSync(filePath, schema, "utf-8");

0 commit comments

Comments
 (0)