Thrimbletrimmer - Editor
+
+
diff --git a/thrimbletrimmer/src/common/googleAuth.tsx b/thrimbletrimmer/src/common/googleAuth.tsx
new file mode 100644
index 0000000..a5d4e02
--- /dev/null
+++ b/thrimbletrimmer/src/common/googleAuth.tsx
@@ -0,0 +1,46 @@
+import { Component } from "solid-js";
+
+export let googleUser: any = null;
+declare var gapi: any; // This is a global we use from the Google Sign In script
+
+function googleOnSignIn(googleUserData) {
+ googleUser = googleUserData;
+
+ const signInElem = document.getElementById("google-auth-sign-in");
+ if (signInElem) {
+ signInElem.classList.remove("hidden");
+ }
+ const signOutElem = document.getElementById("google-auth-sign-out");
+ if (signOutElem) {
+ signOutElem.classList.add("hidden");
+ }
+}
+
+async function googleSignOut() {
+ if (googleUser) {
+ googleUser = null;
+ await gapi.auth2.getAuthInstance().signOut();
+
+ const signInElem = document.getElementById("google-auth-sign-in");
+ if (signInElem) {
+ signInElem.classList.add("hidden");
+ }
+ const signOutElem = document.getElementById("google-auth-sign-out");
+ if (signOutElem) {
+ signOutElem.classList.remove("hidden");
+ }
+ }
+}
+
+// The googleOnSignIn amd googleSignOut functions need to be available to the global scope for Google code to invoke it
+(window as any).googleOnSignIn = googleOnSignIn;
+(window as any).googleSignOut = googleSignOut;
+
+export const GoogleSignIn: Component = () => {
+ return (
+