Merge pull request #124 from ajaythapliyal/feature/final-ui-changes

Nicks Feedback : 12,13 & cleanup
pull/125/head^2
Alex 2 years ago committed by GitHub
commit 4d836d646b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -4,7 +4,7 @@
export default function About() { export default function About() {
return ( return (
//Parent div for all content shown through App.tsx routing needs to have this styling. Might change when state management is updated. //Parent div for all content shown through App.tsx routing needs to have this styling. Might change when state management is updated.
<div className="mx-36 grid min-h-screen"> <div className="mx-5 grid min-h-screen md:mx-36">
<article className=" place-items-left mx-auto my-auto flex w-full max-w-6xl flex-col gap-6 rounded-lg bg-gray-100 p-6 text-jet lg:p-10 xl:p-16"> <article className=" place-items-left mx-auto my-auto flex w-full max-w-6xl flex-col gap-6 rounded-lg bg-gray-100 p-6 text-jet lg:p-10 xl:p-16">
<p className="text-3xl">About DocsGPT 🦖</p> <p className="text-3xl">About DocsGPT 🦖</p>
<p className="mt-4"> <p className="mt-4">

@ -6,7 +6,10 @@ import { useState } from 'react';
import { ActiveState } from './models/misc'; import { ActiveState } from './models/misc';
export default function App() { export default function App() {
const [navState, setNavState] = useState<ActiveState>('ACTIVE'); //TODO : below media query is disjoint from tailwind. Please wire it together.
const [navState, setNavState] = useState<ActiveState>(
window.matchMedia('((min-width: 768px)').matches ? 'ACTIVE' : 'INACTIVE',
);
return ( return (
<div className="min-h-full min-w-full"> <div className="min-h-full min-w-full">

@ -30,7 +30,7 @@ export default function Conversation() {
return ( return (
<div className="flex justify-center p-6"> <div className="flex justify-center p-6">
<div className="w-10/12 transition-all md:w-1/2"> <div className="flex w-10/12 flex-col transition-all md:w-1/2">
{messages.map((message, index) => { {messages.map((message, index) => {
return ( return (
<ConversationBubble <ConversationBubble
@ -48,7 +48,7 @@ export default function Conversation() {
<div <div
ref={inputRef} ref={inputRef}
contentEditable contentEditable
className={`border-000000 overflow-x-hidden; max-h-24 min-h-[2.6rem] w-full overflow-y-auto rounded-xl border bg-white p-2 pr-9 opacity-100 focus:border-2 focus:outline-none`} className={`border-000000 overflow-x-hidden; max-h-24 min-h-[2.6rem] w-full overflow-y-auto whitespace-pre-wrap rounded-xl border bg-white p-2 pr-9 opacity-100 focus:border-2 focus:outline-none`}
onKeyDown={(e) => { onKeyDown={(e) => {
if (e.key === 'Enter' && !e.shiftKey) { if (e.key === 'Enter' && !e.shiftKey) {
e.preventDefault(); e.preventDefault();

@ -16,15 +16,17 @@ const ConversationBubble = forwardRef<
ref={ref} ref={ref}
className={`flex rounded-3xl ${ className={`flex rounded-3xl ${
type === 'ANSWER' type === 'ANSWER'
? 'bg-gray-1000' ? 'self-start bg-gray-1000'
: type === 'ERROR' : type === 'ERROR'
? 'bg-red-1000' ? 'self-start bg-red-1000'
: '' : 'flex-row-reverse self-end bg-blue-1000 text-white'
} py-7 px-5 ${className}`} } py-7 px-5 ${className}`}
> >
<Avatar avatar={type === 'QUESTION' ? '👤' : '🦖'}></Avatar> <Avatar avatar={type === 'QUESTION' ? '👤' : '🦖'}></Avatar>
<div <div
className={`ml-5 flex items-center ${ className={`${
type === 'QUESTION' ? 'mr-5' : 'ml-5'
} flex items-center ${
type === 'ERROR' type === 'ERROR'
? 'rounded-lg border border-red-2000 p-2 text-red-3000' ? 'rounded-lg border border-red-2000 p-2 text-red-3000'
: '' : ''
@ -33,10 +35,12 @@ const ConversationBubble = forwardRef<
{type === 'ERROR' && ( {type === 'ERROR' && (
<img src={Alert} alt="alert" className="mr-2 inline" /> <img src={Alert} alt="alert" className="mr-2 inline" />
)} )}
<span>{message}</span> <p className="whitespace-pre-wrap break-all">{message}</p>
</div> </div>
</div> </div>
); );
}); });
export default ConversationBubble; export default ConversationBubble;
// TODO : split question and answer into two diff JSX

@ -20,12 +20,14 @@ const store = configureStore({
preference: prefSlice.reducer, preference: prefSlice.reducer,
conversation: conversationSlice.reducer, conversation: conversationSlice.reducer,
}, },
middleware: (getDefaultMiddleware) => [ middleware: (getDefaultMiddleware) =>
...getDefaultMiddleware(), getDefaultMiddleware().concat(prefListenerMiddleware.middleware),
prefListenerMiddleware.middleware,
],
}); });
export type RootState = ReturnType<typeof store.getState>; export type RootState = ReturnType<typeof store.getState>;
export type AppDispatch = typeof store.dispatch; export type AppDispatch = typeof store.dispatch;
export default store; export default store;
// TODO : use https://redux-toolkit.js.org/tutorials/typescript#define-typed-hooks everywere instead of direct useDispatch
// TODO : streamline async state management

@ -17,6 +17,7 @@ module.exports = {
'red-1000': 'rgb(254, 202, 202)', 'red-1000': 'rgb(254, 202, 202)',
'red-2000': '#F44336', 'red-2000': '#F44336',
'red-3000': '#621B16', 'red-3000': '#621B16',
'blue-1000': '#7D54D1'
}, },
}, },
}, },

Loading…
Cancel
Save