Skip to content

Commit 43a2f90

Browse files
authored
Merge pull request #74 from CS3219-AY2425S1/d6/ui-fixes
Minor ui fixes
2 parents c780947 + d0376b4 commit 43a2f90

File tree

7 files changed

+15
-12
lines changed

7 files changed

+15
-12
lines changed

backend/collaboration/src/service/get/collab-get-service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ export async function getCollabRoomService(
1818
};
1919
}
2020

21-
const combinedString = `uid1=${userid1}|uid2=${userid2}|qid=${questionid}`;
21+
const randomString = crypto.randomBytes(4).toString('hex');
22+
const combinedString = `uid1=${userid1}|uid2=${userid2}|qid=${questionid}|rand=${randomString}`;
2223
const hash = crypto.createHash('sha256');
2324
const uniqueRoomName = hash.update(combinedString).digest('hex');
2425
return {

frontend/src/components/blocks/interview/ai-chat.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ interface AIChatProps {
1919
}
2020

2121
interface StoredChat {
22-
messages: ChatMessageType[];
22+
messages: Array<ChatMessageType>;
2323
questionDetails: string;
2424
}
2525

@@ -35,7 +35,7 @@ export const AIChat: React.FC<AIChatProps> = ({
3535
language = 'python',
3636
questionDetails = '',
3737
}) => {
38-
const [messages, setMessages] = useState<ChatMessageType[]>([]);
38+
const [messages, setMessages] = useState<Array<ChatMessageType>>([]);
3939
const [isLoading, setIsLoading] = useState<boolean>(false);
4040
const [error, setError] = useState<string | null>(null);
4141
const streamingTextRef = useRef<string>('');
@@ -179,7 +179,7 @@ export const AIChat: React.FC<AIChatProps> = ({
179179
title='AI Assistant'
180180
onClearHistory={handleClearHistory}
181181
CustomPlaceHolderElem={({ onSend }) => (
182-
<div className='flex flex-col gap-6 text-center'>
182+
<div className='flex w-full flex-col gap-6 text-center'>
183183
<MessageSquareIcon className='mx-auto size-12 opacity-50' />
184184
<p>No messages yet. Start a conversation, or use one of these prompts:</p>
185185
<div className='flex flex-wrap gap-4'>
@@ -188,7 +188,7 @@ export const AIChat: React.FC<AIChatProps> = ({
188188
key={index}
189189
variant='outline'
190190
size='sm'
191-
className='rounded-xl'
191+
className='max-w-full whitespace-normal break-words rounded-xl '
192192
onClick={() => onSend(value)}
193193
>
194194
<span>{value}</span>

frontend/src/components/blocks/interview/chat/chat-message.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ export const ChatMessage: React.FC<ChatMessageProps> = ({ message }) => {
2626
className={cn(
2727
'prose prose-neutral text-sm text-primary',
2828
'prose-a:text-blue-500 prose-code:text-secondary-foreground prose-pre:ml-2 prose-pre:bg-transparent prose-pre:p-0',
29-
'prose-headings:text-primary prose-strong:text-primary prose-p:text-primary'
29+
'prose-headings:text-primary prose-strong:text-primary prose-p:text-primary',
30+
'break-words'
3031
)}
3132
>
3233
{message.text}

frontend/src/components/blocks/interview/editor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { CompleteDialog } from './room/complete-dialog';
2222
import { OtherUserCompletingDialog } from './room/other-user-completing-dialog';
2323

2424
const EXTENSION_HEIGHT = 250;
25-
const MIN_EDITOR_HEIGHT = 350;
25+
const MIN_EDITOR_HEIGHT = 150;
2626

2727
type EditorProps = {
2828
questionId: number;

frontend/src/components/blocks/interview/question-attempts/table.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ export function QuestionAttemptsTable<TValue>({
171171
</Button>
172172
</PaginationItem>
173173
<PaginationItem className='text-sm'>
174-
{table.getState().pagination.pageIndex + 1} of {table.getPageCount()}
174+
{table.getState().pagination.pageIndex + 1} of{' '}
175+
{Math.max(1, table.getPageCount())}
175176
</PaginationItem>
176177
<PaginationItem className='ml-1'>
177178
<Button

frontend/src/routes/interview/[room]/main.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ export const InterviewRoom = () => {
5959
) : (
6060
<WithNavBlocker>
6161
<WithNavBanner crumbs={crumbs}>
62-
<div className='flex flex-1 overflow-hidden'>
63-
<Card className='border-border m-4 flex w-[500px] overflow-hidden p-4 md:w-2/5'>
62+
<div className='scrollbar-track-transparent scrollbar-thin flex flex-1 overflow-hidden sm:overflow-x-auto sm:overflow-y-hidden'>
63+
<Card className='border-border m-4 flex w-[500px] overflow-hidden p-4 md:w-2/5 md:min-w-[292px]'>
6464
<Tabs defaultValue='details' className='size-full'>
6565
<TabsList className=''>
6666
<TabsTrigger value='details'>Question Details</TabsTrigger>
@@ -85,7 +85,7 @@ export const InterviewRoom = () => {
8585
/>
8686
</div>
8787
{(isAIChatOpen || isPartnerChatOpen) && (
88-
<Card className='border-border m-4 w-[500px] overflow-hidden md:w-1/3'>
88+
<Card className='border-border m-4 w-[500px] overflow-hidden md:w-1/3 md:min-w-[376px]'>
8989
{isAIChatOpen && (
9090
<AIChat
9191
isOpen={isAIChatOpen}

frontend/src/routes/match/match-form.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ export const MatchForm = ({ topics, difficulties }: MatchFormProps) => {
8585
})}
8686
</MultiSelectorList>
8787
</MultiSelectorContent>
88+
<FormMessage />
8889
</MultiSelector>
8990
</FormControl>
90-
<FormMessage />
9191
</FormItem>
9292
)}
9393
/>

0 commit comments

Comments
 (0)