-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update diffs for rohittp0/charcha at Sat Apr 13 00:33:56 UTC 2024
- Loading branch information
github-actions
committed
Apr 13, 2024
1 parent
a43a590
commit 3336237
Showing
2 changed files
with
259 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
diff --git a/ui/src/pages/layout.tsx b/ui/src/pages/layout.tsx | ||
index f18ceae..98db022 100644 | ||
--- a/ui/src/pages/layout.tsx | ||
+++ b/ui/src/pages/layout.tsx | ||
@@ -2,8 +2,9 @@ import {Route, Routes, useLocation, useNavigate} from "react-router-dom"; | ||
import {useAuthState} from "react-firebase-hooks/auth"; | ||
import {auth} from "../api/firebase"; | ||
import React, {useEffect, useState} from "react"; | ||
-import {LeftPane, RightPane} from "./chat"; | ||
-import {LeftPane_new, RightPane_new} from "./new_topic" | ||
+ | ||
+import * as Chat from "./chat"; | ||
+import * as NewTopic from "./new_topic" | ||
|
||
export default function BaseLayout() { | ||
const navigate = useNavigate(); // Hook to programmatically navigate | ||
@@ -64,8 +65,8 @@ export default function BaseLayout() { | ||
style={{filter: 'brightness(0) invert(1)'}} className="h-12 w-32"/> | ||
</div> | ||
<Routes> | ||
- <Route path="/new/*" element={<LeftPane_new />}/> | ||
- <Route path="/*" element={<LeftPane setHeader={setHeader}/>}/> | ||
+ <Route path="/new/*" element={<NewTopic.LeftPane />}/> | ||
+ <Route path="/*" element={<Chat.LeftPane setHeader={setHeader}/>}/> | ||
</Routes> | ||
<div className="flex flex-grow"/> | ||
<div className="p-4 flex justify-center"> | ||
@@ -100,8 +101,8 @@ export default function BaseLayout() { | ||
<h2 className="text-xl font-bold">{header}</h2> | ||
</div> | ||
<Routes> | ||
- <Route path="/chats/:chatId" element={<RightPane/>}/> | ||
- <Route path="/new/:userId" element={<RightPane_new/>}/> | ||
+ <Route path="/chats/:chatId" element={<Chat.RightPane/>}/> | ||
+ <Route path="/new/:userId" element={<NewTopic.RightPane/>}/> | ||
</Routes> | ||
</div> | ||
} | ||
diff --git a/ui/src/pages/new_topic/LeftPane_new.tsx b/ui/src/pages/new_topic/LeftPane.tsx | ||
similarity index 95% | ||
rename from ui/src/pages/new_topic/LeftPane_new.tsx | ||
rename to ui/src/pages/new_topic/LeftPane.tsx | ||
index 73b4ed0..1b25397 100644 | ||
--- a/ui/src/pages/new_topic/LeftPane_new.tsx | ||
+++ b/ui/src/pages/new_topic/LeftPane.tsx | ||
@@ -6,11 +6,11 @@ import {useAuthState} from "react-firebase-hooks/auth"; | ||
import {auth} from "../../api/firebase"; | ||
|
||
|
||
-export default function LeftPane_new( ) { | ||
+export default function LeftPane( ) { | ||
const [user] = useAuthState(auth); | ||
|
||
const collectionMemo = useMemo(() => | ||
- collection(firestore, `submissions/${user?.uid}/topics`), []); | ||
+ collection(firestore, `submissions/${user?.uid}/topics`), [user]); | ||
const orderByMemo = useMemo(() => | ||
orderBy("timestamp", "desc"), []); | ||
|
||
diff --git a/ui/src/pages/new_topic/RightPane_new.tsx b/ui/src/pages/new_topic/RightPane.tsx | ||
similarity index 98% | ||
rename from ui/src/pages/new_topic/RightPane_new.tsx | ||
rename to ui/src/pages/new_topic/RightPane.tsx | ||
index 5f0ae94..7752e1b 100644 | ||
--- a/ui/src/pages/new_topic/RightPane_new.tsx | ||
+++ b/ui/src/pages/new_topic/RightPane.tsx | ||
@@ -9,7 +9,7 @@ interface IMessage { | ||
timestamp?: Date; | ||
} | ||
|
||
-export default function RightPane_new() { | ||
+export default function RightPane() { | ||
const [user] = useAuthState(auth); | ||
const [message, setMessage] = useState(""); | ||
const [recentMessage, setRecentMessage] = useState<IMessage | null>(null); | ||
diff --git a/ui/src/pages/new_topic/index.tsx b/ui/src/pages/new_topic/index.tsx | ||
index 71c7c2e..f2d58c1 100644 | ||
--- a/ui/src/pages/new_topic/index.tsx | ||
+++ b/ui/src/pages/new_topic/index.tsx | ||
@@ -1,4 +1,4 @@ | ||
-import LeftPane_new from './LeftPane_new'; | ||
-import RightPane_new from './RightPane_new'; | ||
+import LeftPane from './LeftPane'; | ||
+import RightPane from './RightPane'; | ||
|
||
-export {LeftPane_new, RightPane_new}; | ||
+export {LeftPane, RightPane}; | ||
diff --git a/ui/src/pages/new_topic/texp.txt b/ui/src/pages/new_topic/texp.txt | ||
deleted file mode 100644 | ||
index d3b73cf..0000000 | ||
--- a/ui/src/pages/new_topic/texp.txt | ||
+++ /dev/null | ||
@@ -1,58 +0,0 @@ | ||
-import React, { useEffect, useState,useMemo } from "react"; | ||
-import { collection, query, orderBy, getDocs } from "firebase/firestore"; | ||
-import { firestore } from "../../api/firebase"; | ||
-import { useAuthState } from "react-firebase-hooks/auth"; | ||
-import { auth } from "../../api/firebase"; | ||
- | ||
- | ||
-interface Topic { | ||
- id: string; | ||
- content: string; | ||
- timestamp?: Date; | ||
-} | ||
- | ||
-export default function LeftPane_new( ) { | ||
- const [user, loading, error] = useAuthState(auth); | ||
- const [topics, setTopics] = useState<Topic[]>([]); | ||
- | ||
- const topicsQuery = useMemo(() => { | ||
- if (user) { | ||
- return query(collection(firestore, `submissions/${user.uid}/topics`), orderBy("timestamp", "desc")); | ||
- } | ||
- return null; | ||
- }, [user]); | ||
- | ||
- useEffect(() => { | ||
- const fetchTopics = async () => { | ||
- if (topicsQuery) { | ||
- const querySnapshot = await getDocs(topicsQuery); | ||
- const fetchedTopics = querySnapshot.docs.map(doc => ({ | ||
- id: doc.id, | ||
- ...doc.data() | ||
- })); | ||
- setTopics(fetchedTopics as Topic[]); | ||
- } | ||
- }; | ||
- | ||
- if (!loading && !error && topicsQuery) { | ||
- fetchTopics(); | ||
- } | ||
- }, [topicsQuery, loading, error]); | ||
- | ||
- if (loading) { | ||
- return <div>Loading...</div>; | ||
- } | ||
- | ||
- if (error) { | ||
- return <div>Error: {error.message}</div>; | ||
- } | ||
- return ( | ||
- <div> | ||
- {topics.map((topic) => ( | ||
- <div className="p-4 cursor-pointer hover:bg-gray-200"> | ||
- <p className="font-semibold">{topic.content}</p> | ||
- </div> | ||
- ))} | ||
- </div> | ||
- ); | ||
-} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
{ | ||
"id": 779373793, | ||
"node_id": "R_kgDOLnRM4Q", | ||
"name": "charcha", | ||
"full_name": "rohittp0/charcha", | ||
"private": false, | ||
"owner": { | ||
"login": "rohittp0", | ||
"id": 45072928, | ||
"node_id": "MDQ6VXNlcjQ1MDcyOTI4", | ||
"avatar_url": "https://avatars.githubusercontent.com/u/45072928?v=4", | ||
"gravatar_id": "", | ||
"url": "https://api.github.com/users/rohittp0", | ||
"html_url": "https://github.com/rohittp0", | ||
"followers_url": "https://api.github.com/users/rohittp0/followers", | ||
"following_url": "https://api.github.com/users/rohittp0/following{/other_user}", | ||
"gists_url": "https://api.github.com/users/rohittp0/gists{/gist_id}", | ||
"starred_url": "https://api.github.com/users/rohittp0/starred{/owner}{/repo}", | ||
"subscriptions_url": "https://api.github.com/users/rohittp0/subscriptions", | ||
"organizations_url": "https://api.github.com/users/rohittp0/orgs", | ||
"repos_url": "https://api.github.com/users/rohittp0/repos", | ||
"events_url": "https://api.github.com/users/rohittp0/events{/privacy}", | ||
"received_events_url": "https://api.github.com/users/rohittp0/received_events", | ||
"type": "User", | ||
"site_admin": false | ||
}, | ||
"html_url": "https://github.com/rohittp0/charcha", | ||
"description": "Charcha is a group chat built exclusively for AI Agents. There are 5 AI Agents giving out their valuable insights on the topics of your choice", | ||
"fork": false, | ||
"url": "https://api.github.com/repos/rohittp0/charcha", | ||
"forks_url": "https://api.github.com/repos/rohittp0/charcha/forks", | ||
"keys_url": "https://api.github.com/repos/rohittp0/charcha/keys{/key_id}", | ||
"collaborators_url": "https://api.github.com/repos/rohittp0/charcha/collaborators{/collaborator}", | ||
"teams_url": "https://api.github.com/repos/rohittp0/charcha/teams", | ||
"hooks_url": "https://api.github.com/repos/rohittp0/charcha/hooks", | ||
"issue_events_url": "https://api.github.com/repos/rohittp0/charcha/issues/events{/number}", | ||
"events_url": "https://api.github.com/repos/rohittp0/charcha/events", | ||
"assignees_url": "https://api.github.com/repos/rohittp0/charcha/assignees{/user}", | ||
"branches_url": "https://api.github.com/repos/rohittp0/charcha/branches{/branch}", | ||
"tags_url": "https://api.github.com/repos/rohittp0/charcha/tags", | ||
"blobs_url": "https://api.github.com/repos/rohittp0/charcha/git/blobs{/sha}", | ||
"git_tags_url": "https://api.github.com/repos/rohittp0/charcha/git/tags{/sha}", | ||
"git_refs_url": "https://api.github.com/repos/rohittp0/charcha/git/refs{/sha}", | ||
"trees_url": "https://api.github.com/repos/rohittp0/charcha/git/trees{/sha}", | ||
"statuses_url": "https://api.github.com/repos/rohittp0/charcha/statuses/{sha}", | ||
"languages_url": "https://api.github.com/repos/rohittp0/charcha/languages", | ||
"stargazers_url": "https://api.github.com/repos/rohittp0/charcha/stargazers", | ||
"contributors_url": "https://api.github.com/repos/rohittp0/charcha/contributors", | ||
"subscribers_url": "https://api.github.com/repos/rohittp0/charcha/subscribers", | ||
"subscription_url": "https://api.github.com/repos/rohittp0/charcha/subscription", | ||
"commits_url": "https://api.github.com/repos/rohittp0/charcha/commits{/sha}", | ||
"git_commits_url": "https://api.github.com/repos/rohittp0/charcha/git/commits{/sha}", | ||
"comments_url": "https://api.github.com/repos/rohittp0/charcha/comments{/number}", | ||
"issue_comment_url": "https://api.github.com/repos/rohittp0/charcha/issues/comments{/number}", | ||
"contents_url": "https://api.github.com/repos/rohittp0/charcha/contents/{+path}", | ||
"compare_url": "https://api.github.com/repos/rohittp0/charcha/compare/{base}...{head}", | ||
"merges_url": "https://api.github.com/repos/rohittp0/charcha/merges", | ||
"archive_url": "https://api.github.com/repos/rohittp0/charcha/{archive_format}{/ref}", | ||
"downloads_url": "https://api.github.com/repos/rohittp0/charcha/downloads", | ||
"issues_url": "https://api.github.com/repos/rohittp0/charcha/issues{/number}", | ||
"pulls_url": "https://api.github.com/repos/rohittp0/charcha/pulls{/number}", | ||
"milestones_url": "https://api.github.com/repos/rohittp0/charcha/milestones{/number}", | ||
"notifications_url": "https://api.github.com/repos/rohittp0/charcha/notifications{?since,all,participating}", | ||
"labels_url": "https://api.github.com/repos/rohittp0/charcha/labels{/name}", | ||
"releases_url": "https://api.github.com/repos/rohittp0/charcha/releases{/id}", | ||
"deployments_url": "https://api.github.com/repos/rohittp0/charcha/deployments", | ||
"created_at": "2024-03-29T17:30:07Z", | ||
"updated_at": "2024-04-12T05:33:30Z", | ||
"pushed_at": "2024-04-12T20:24:47Z", | ||
"git_url": "git://github.com/rohittp0/charcha.git", | ||
"ssh_url": "git@github.com:rohittp0/charcha.git", | ||
"clone_url": "https://github.com/rohittp0/charcha.git", | ||
"svn_url": "https://github.com/rohittp0/charcha", | ||
"homepage": "https://charchas.web.app", | ||
"size": 2031, | ||
"stargazers_count": 1, | ||
"watchers_count": 1, | ||
"language": "TypeScript", | ||
"has_issues": true, | ||
"has_projects": true, | ||
"has_downloads": true, | ||
"has_wiki": true, | ||
"has_pages": false, | ||
"has_discussions": false, | ||
"forks_count": 1, | ||
"mirror_url": null, | ||
"archived": false, | ||
"disabled": false, | ||
"open_issues_count": 1, | ||
"license": null, | ||
"allow_forking": true, | ||
"is_template": false, | ||
"web_commit_signoff_required": false, | ||
"topics": [ | ||
"chat-application", | ||
"discussion", | ||
"experiment", | ||
"llm" | ||
], | ||
"visibility": "public", | ||
"forks": 1, | ||
"open_issues": 1, | ||
"watchers": 1, | ||
"default_branch": "master", | ||
"temp_clone_token": null, | ||
"network_count": 1, | ||
"subscribers_count": 1 | ||
} |