diff --git a/dataconnect/.idx/dev.nix b/dataconnect/.idx/dev.nix index ea67bb36c..bb220b24a 100644 --- a/dataconnect/.idx/dev.nix +++ b/dataconnect/.idx/dev.nix @@ -1,45 +1,45 @@ -{ pkgs, ... }: { - channel = "stable-23.11"; - packages = [ - pkgs.nodejs_20 - ]; - - env = { - POSTGRESQL_CONN_STRING = "postgresql://user:mypassword@localhost:5432/dataconnect?sslmode=disable"; - }; +{ pkgs, ... }: + { + channel = "stable-24.05"; + packages = [ + pkgs.nodejs_20 + ]; + + env = { + FIREBASE_DATACONNECT_POSTGRESQL_STRING = "postgresql://user:mypassword@localhost:5432/dataconnect?sslmode=disable"; + }; - idx.extensions = [ - "mtxr.sqltools" - "mtxr.sqltools-driver-pg" - "GraphQL.vscode-graphql-syntax" - "GoogleCloudTools.firebase-dataconnect-vscode" - ]; + services.postgres = { + extensions = ["pgvector"]; + enable = true; + }; - services.postgres = { - extensions = ["pgvector"]; - enable = true; - }; - - idx = { - workspace = { - onCreate = { - update-firebase = "npm install -D firebase-tools"; - postgres = '' - psql --dbname=postgres -c "ALTER USER \"user\" PASSWORD 'mypassword';" - psql --dbname=postgres -c "CREATE DATABASE dataconnect;" - psql --dbname=dataconnect -c "CREATE EXTENSION vector;" - ''; - npm-install = "cd app && npm i && npm i firebase@latest"; + idx = { + extensions = [ + "mtxr.sqltools" + "mtxr.sqltools-driver-pg" + "GraphQL.vscode-graphql-syntax" + "GoogleCloudTools.firebase-dataconnect-vscode" + ]; + workspace = { + onCreate = { + update-firebase = "npm install -g firebase-tools"; + postgres = '' + psql --dbname=postgres -c "ALTER USER \"user\" PASSWORD 'mypassword';" + psql --dbname=postgres -c "CREATE DATABASE dataconnect;" + psql --dbname=dataconnect -c "CREATE EXTENSION vector;" + ''; + npm-install = "cd app && npm i"; + }; }; - }; - previews = { - enable = true; previews = { - web = { - command = ["npm" "run" "dev" "--prefix" "./app" "--" "--port" "$PORT" "--host" "0.0.0.0"]; - manager = "web"; + enable = true; + previews = { + web = { + command = ["npm" "run" "dev" "--prefix" "./app" "--" "--port" "$PORT" "--host" "0.0.0.0"]; + manager = "web"; + }; }; }; }; - }; -} \ No newline at end of file +} diff --git a/dataconnect/README.md b/dataconnect/README.md index 2fea10be7..06120471a 100644 --- a/dataconnect/README.md +++ b/dataconnect/README.md @@ -2,7 +2,7 @@ ## Introduction -This is a sample app for the preview version of Firebase DataConnect. This service is currently in Private Preview at no cost for a limited time. Sign up for the program at [Firebase Data Connect](https://firebase.google.com/products/data-connect). This quickstart will not work if you don't have access to the preview. +This is a sample app for the preview version of Firebase DataConnect. This service is currently in Public Preview at no cost for a limited time. ## Getting Started with Firebase DataConnect @@ -88,9 +88,8 @@ This repository contains the quickstart to help you explore the functionalities npm run build ``` -5. Set up Firebase Authentication with Google Sign-In. Optionally, allow domains for [Firebase Auth](https://firebase.google.com/docs/auth/web/hosting) in your project console (e.g., `http://127.0.0.1`). -6. Allow domains for Firebase Auth in your [project console](https://console.firebase.google.com/project/_/authentication/settings) (e.g., `http://127.0.0.1`). -7. In `dataconnect/dataconnect.yaml`, ensure that your `instanceId`, `database`, and `serviceId` match your project configuration: +5. Allow domains for Firebase Auth in your [project console](https://console.firebase.google.com/project/_/authentication/settings) (e.g., `http://127.0.0.1`). +6. In `dataconnect/dataconnect.yaml`, ensure that your `instanceId`, `database`, and `serviceId` match your project configuration: ```yaml specVersion: "v1alpha" @@ -106,7 +105,7 @@ This repository contains the quickstart to help you explore the functionalities connectorDirs: ["./movie-connector"] ``` -8. Deploy your project: +7. Deploy your project: ```bash npm install -g firebase-tools @@ -115,13 +114,13 @@ This repository contains the quickstart to help you explore the functionalities firebase deploy --only dataconnect,hosting ``` -9. To compare schema changes, run: +8. To compare schema changes, run: ```bash firebase dataconnect:sql:diff ``` -10. If the changes are acceptable, apply them with: +9. If the changes are acceptable, apply them with: ```bash firebase dataconnect:sql:migrate diff --git a/dataconnect/app/src/components/navbar.tsx b/dataconnect/app/src/components/navbar.tsx index bf73ad6f4..775c2aff7 100644 --- a/dataconnect/app/src/components/navbar.tsx +++ b/dataconnect/app/src/components/navbar.tsx @@ -1,5 +1,5 @@ import React, { useEffect, useState, useContext } from 'react'; -import { signInWithPopup, GoogleAuthProvider, signOut, User } from 'firebase/auth'; +import { signInWithRedirect, GoogleAuthProvider, signOut, User } from 'firebase/auth'; import { AuthContext } from '@/lib/firebase'; import { Link } from 'react-router-dom'; import { handleAuthStateChange } from '@/lib/MovieService'; @@ -18,7 +18,7 @@ export default function Navbar() { async function handleSignIn() { const provider = new GoogleAuthProvider(); - await signInWithPopup(auth, provider); + await signInWithRedirect(auth, provider); } async function handleSignOut() { diff --git a/dataconnect/app/src/pages/Home.tsx b/dataconnect/app/src/pages/Home.tsx index 7e4b19635..798b656c4 100644 --- a/dataconnect/app/src/pages/Home.tsx +++ b/dataconnect/app/src/pages/Home.tsx @@ -7,8 +7,17 @@ const ConditionalRender = ({ condition, preferred, alternate }: { condition: boo ) const PlaceholderMessage = () => ( -