-
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.
introduce conversations list introduce layout
- Loading branch information
Showing
25 changed files
with
427 additions
and
140 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
.chatThread { | ||
|
||
overflow: auto; | ||
} |
18 changes: 18 additions & 0 deletions
18
src/components/ConversationsList/ConversationItem/index.tsx
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,18 @@ | ||
import React, {FunctionComponent} from 'react'; | ||
import Link from "next/link"; | ||
import {ConversationItem as Conversation} from "@/types/ChatThread"; | ||
import styles from "./styles.module.scss"; | ||
|
||
type ConversationItemProps = { | ||
conversation: Conversation | ||
} | ||
|
||
const ConversationItem: FunctionComponent<ConversationItemProps> = ({ conversation }) => { | ||
return ( | ||
<Link className={styles.conversationItem} href={`/conversation/${conversation.id}`}> | ||
{conversation.title} | ||
</Link> | ||
); | ||
} | ||
|
||
export default ConversationItem; |
6 changes: 6 additions & 0 deletions
6
src/components/ConversationsList/ConversationItem/styles.module.scss
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,6 @@ | ||
.conversationItem { | ||
display: block; | ||
padding: 0.8rem; | ||
border-radius: 1rem; | ||
border: 1px solid var(--primary-foreground); | ||
} |
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,19 @@ | ||
import React, {FunctionComponent} from 'react'; | ||
import {useQuery} from "react-query"; | ||
import {ConversationItem as Conversation} from "@/types/ChatThread"; | ||
import ConversationItem from "@/components/ConversationsList/ConversationItem"; | ||
|
||
const ConversationsList: FunctionComponent = (props) => { | ||
const {data} = useQuery<Conversation[]>("conversations", () => { | ||
return fetch(process.env.NEXT_PUBLIC_BACKEND_API + "/api/conversations").then((res) => res.json()); | ||
}); | ||
return ( | ||
<div> | ||
{data && data.map((conversation) => { | ||
return <ConversationItem key={conversation.id} conversation={conversation} /> | ||
})} | ||
</div> | ||
); | ||
} | ||
|
||
export default ConversationsList; |
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,30 @@ | ||
import React, {FC, PropsWithChildren} from 'react' | ||
import styles from './styles.module.scss' | ||
import clsx from "clsx"; | ||
import ConversationsList from "@/components/ConversationsList"; | ||
import UploadPDF from "@/components/UploadPDF"; | ||
import ThemeChanger from "@/components/ThemeChanger"; | ||
|
||
type ScaffoldingProps = { | ||
className?: string | ||
mainContentClassName?: string | ||
} | ||
|
||
const Scaffolding: FC<PropsWithChildren<ScaffoldingProps>> = ({className, mainContentClassName, children}) => { | ||
return ( | ||
<div id="root" className={clsx(styles.container, className)}> | ||
<header> | ||
<UploadPDF/> | ||
<ThemeChanger/> | ||
</header> | ||
<aside> | ||
<ConversationsList/> | ||
</aside> | ||
<main className={clsx(styles.contentWrapper, mainContentClassName)}> | ||
{children} | ||
</main> | ||
</div> | ||
) | ||
} | ||
|
||
export default Scaffolding |
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,40 @@ | ||
@import "src/styles/background-patterns"; | ||
|
||
.container { | ||
display: grid; | ||
height: 100vh; | ||
grid-template-columns: 300px auto; | ||
grid-template-rows: 100px calc(100vh - 100px); | ||
grid-template-areas: "header header" | ||
"aside main"; | ||
grid-gap: 0 1rem; | ||
|
||
> header { | ||
grid-area: header; | ||
display: flex; | ||
padding: 1rem; | ||
align-items: center; | ||
justify-content: space-between; | ||
@include background-pattern-2(var(--secondary-background), var(--primary-background)); | ||
} | ||
|
||
> aside, > main { | ||
padding: 1rem 1rem 1rem 0; | ||
} | ||
|
||
> aside { | ||
grid-area: aside; | ||
padding-left: 1rem; | ||
@include background-pattern-2(var(--secondary-background), var(--primary-background)); | ||
} | ||
|
||
> main { | ||
grid-area: main; | ||
} | ||
} | ||
|
||
.contentWrapper { | ||
padding: 1.5rem; | ||
width: 100%; | ||
@include background-pattern-2(var(--secondary-background), var(--primary-background)); | ||
} |
Oops, something went wrong.