-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/madp 92 #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Feat/madp 92 #6
Changes from 3 commits
eaac009
0c29235
9fe18f7
d791945
96435fe
2b35468
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| 'use client'; | ||
|
|
||
| import { useState, useEffect } from 'react'; | ||
| import Image from 'next/image'; | ||
| import { colors } from '@/styles/colors'; | ||
| import * as S from './style'; | ||
|
|
||
| const USER_MESSAGE = "μ΅μ μ μ¬μΈ νλ‘μ νΈμ CPU μ¬μ©λμ μκ³ μΆμ΄"; | ||
| const AI_MESSAGE = "μ’μ΅λλ€, λ€μμ μ΅μ μ μ¬μΈ νλ‘μ νΈμ CPU μ¬μ©λ μ λλ€."; | ||
|
|
||
| export default function AgentPage() { | ||
| const [isChatStarted, setIsChatStarted] = useState(false); | ||
| const [streamedText, setStreamedText] = useState(""); | ||
| const [inputValue, setInputValue] = useState(""); | ||
|
|
||
| useEffect(() => { | ||
| if (isChatStarted) { | ||
| let currentIndex = 0; | ||
| const interval = setInterval(() => { | ||
| if (currentIndex <= AI_MESSAGE.length) { | ||
| setStreamedText(AI_MESSAGE.slice(0, currentIndex)); | ||
| currentIndex++; | ||
| } else { | ||
| clearInterval(interval); | ||
| } | ||
| }, 50); | ||
|
|
||
| return () => clearInterval(interval); | ||
| } | ||
| }, [isChatStarted]); | ||
|
|
||
| const handleSearch = (e?: React.FormEvent) => { | ||
| e?.preventDefault(); | ||
| if (!isChatStarted) { | ||
| setIsChatStarted(true); | ||
| } | ||
| setInputValue(""); | ||
| }; | ||
|
|
||
| const handleKeyDown = (e: React.KeyboardEvent) => { | ||
| if (e.key === 'Enter') { | ||
| handleSearch(); | ||
| } | ||
| }; | ||
|
|
||
| return ( | ||
| <S.Container isChat={isChatStarted}> | ||
| {!isChatStarted && ( | ||
| <S.LogoSection> | ||
| <Image | ||
| src="/assets/logo.svg" | ||
| alt="M-ADP Logo" | ||
| width={100} | ||
| height={92} | ||
| priority | ||
| /> | ||
| <S.LogoTitle>M-ADP</S.LogoTitle> | ||
| </S.LogoSection> | ||
| )} | ||
|
|
||
| {isChatStarted && ( | ||
| <S.ChatArea> | ||
| <S.MessageRow> | ||
| <S.Avatar color={colors.primary.default}> | ||
| N | ||
| </S.Avatar> | ||
| <S.UserMessageCard> | ||
| {USER_MESSAGE} | ||
| </S.UserMessageCard> | ||
| </S.MessageRow> | ||
|
|
||
| <S.MessageRow> | ||
| <S.Avatar> | ||
| <Image | ||
| src="/assets/logo.svg" | ||
| alt="AI Avatar" | ||
| width={24} | ||
| height={24} | ||
| /> | ||
| </S.Avatar> | ||
| <S.AIMessageCard> | ||
| {streamedText} | ||
| </S.AIMessageCard> | ||
| </S.MessageRow> | ||
| </S.ChatArea> | ||
| )} | ||
|
Comment on lines
64
to
69
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Chat always displays the same hardcoded user message regardless of actual input. When chat starts, +const [userMessage, setUserMessage] = useState("");
...
const handleSearch = (e?: React.FormEvent) => {
e?.preventDefault();
+ if (!inputValue.trim()) return;
+ setUserMessage(inputValue);
if (!isChatStarted) {
setIsChatStarted(true);
}
setInputValue("");
};Then render π€ Prompt for AI Agents |
||
|
|
||
| <S.SearchContainer> | ||
| <S.InputWrapper> | ||
| <S.IconCircle> | ||
| <svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
| <path d="M12 4L14.4 9.6L20 12L14.4 14.4L12 20L9.6 14.4L4 12L9.6 9.6L12 4Z" fill="#969696" /> | ||
| </svg> | ||
| </S.IconCircle> | ||
| <S.SearchInput | ||
| placeholder="무μμ μνμλμ?" | ||
| value={inputValue} | ||
| onChange={(e) => setInputValue(e.target.value)} | ||
| onKeyDown={handleKeyDown} | ||
| /> | ||
| </S.InputWrapper> | ||
|
|
||
| <S.IconCircle className="send-button" onClick={handleSearch}> | ||
| <svg width="18" height="18" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
| <path d="M12 19V5M12 5L5 12M12 5L19 12" stroke="white" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" /> | ||
| </svg> | ||
| </S.IconCircle> | ||
| </S.SearchContainer> | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| </S.Container> | ||
| ); | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,159 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import styled from '@emotion/styled'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { colors } from '@/styles/colors'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { typography } from '@/styles/typography'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export const Container = styled.div<{ isChat?: boolean }>` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| display: flex; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| flex-direction: column; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| align-items: center; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| justify-content: ${({ isChat }) => (isChat ? 'space-between' : 'center')}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| width: 100%; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| height: 100%; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| background-color: #ffffff; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| padding: ${({ isChat }) => (isChat ? '40px 0' : '0')}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| box-sizing: border-box; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| `; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+4
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π§© Analysis chainπ Script executed: # First, let's check the current state of style.ts
cat -n src/app/agent/style.tsRepository: M-ADP/M-ADP-CLIENT Length of output: 1065 π Script executed: # Check how Container is used in page.tsx
rg -n 'isChat' --type=ts --type=tsx -C 3Repository: M-ADP/M-ADP-CLIENT Length of output: 89 π Script executed: # Also check for any imports or usage of Container component
rg -n 'Container' src/app/agent/ --type=ts --type=tsx -C 2Repository: M-ADP/M-ADP-CLIENT Length of output: 89 π Script executed: # Search for isChat usage more broadly
rg 'isChat' --type-add 'typescripts:*.ts' --type-add 'typescripts:*.tsx'Repository: M-ADP/M-ADP-CLIENT Length of output: 713 π Script executed: # Look at the agent page.tsx file directly
find . -name 'page.tsx' -path '*/agent/*' -type fRepository: M-ADP/M-ADP-CLIENT Length of output: 86 π Script executed: # Search for Container usage in agent directory
rg 'Container' src/app/agent/ -A 2 -B 2Repository: M-ADP/M-ADP-CLIENT Length of output: 734 Use transient prop syntax for Emotion's Required changes-export const Container = styled.div<{ isChat?: boolean }>`
+export const Container = styled.div<{ $isChat?: boolean }>`
display: flex;
flex-direction: column;
align-items: center;
- justify-content: ${({ isChat }) => (isChat ? 'space-between' : 'center')};
+ justify-content: ${({ $isChat }) => ($isChat ? 'space-between' : 'center')};
width: 100%;
height: 100%;
background-color: `#ffffff`;
- padding: ${({ isChat }) => (isChat ? '40px 0' : '0')};
+ padding: ${({ $isChat }) => ($isChat ? '40px 0' : '0')};
box-sizing: border-box;
`;Also update -<S.Container isChat={isChatStarted}>
+<S.Container $isChat={isChatStarted}>π Committable suggestion
Suggested change
π€ Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export const LogoSection = styled.div` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| display: flex; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| align-items: center; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| gap: 28px; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| margin-bottom: 60px; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| `; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export const LogoTitle = styled.span` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| font-family: 'IBM Plex Sans KR', sans-serif; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| font-weight: 700; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| font-size: 80px; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| line-height: normal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| color: ${colors.black[300]}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| margin: 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| `; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export const SearchContainer = styled.div` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| display: flex; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| align-items: center; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| justify-content: space-between; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| width: 100%; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| max-width: 800px; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| height: 52px; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| padding: 0 20px; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| background: #ffffff; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| border: 1px solid ${colors.black[50]}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| border-radius: 26px; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| box-sizing: border-box; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| transition: border-color 0.2s ease; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| margin-bottom: 20px; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| &:focus-within { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| border-color: ${colors.primary.default}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| `; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export const InputWrapper = styled.div` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| display: flex; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| align-items: center; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| gap: 12px; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| flex: 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| `; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export const IconCircle = styled.div` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| display: flex; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| align-items: center; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| justify-content: center; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| width: 28px; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| height: 28px; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| border-radius: 50%; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| overflow: hidden; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| flex-shrink: 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| &.send-button { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| background: ${colors.primary.default}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cursor: pointer; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| border: 1px solid ${colors.primary.default}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| `; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export const SearchInput = styled.input` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| border: none; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| background: transparent; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| width: 100%; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| padding: 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| font-family: ${typography.text16Medium.fontFamily}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| font-size: ${typography.text16Medium.fontSize}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| font-weight: ${typography.text16Medium.fontWeight}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| line-height: ${typography.text16Medium.lineHeight}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| color: ${colors.black[75]}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| outline: none; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| &::placeholder { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| color: ${colors.black[75]}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| `; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export const SearchInput = styled.input` | |
| border: none; | |
| background: transparent; | |
| width: 100%; | |
| padding: 0; | |
| font-family: ${typography.text16Medium.fontFamily}; | |
| font-size: ${typography.text16Medium.fontSize}; | |
| font-weight: ${typography.text16Medium.fontWeight}; | |
| line-height: ${typography.text16Medium.lineHeight}; | |
| color: ${colors.black[75]}; | |
| outline: none; | |
| &::placeholder { | |
| color: ${colors.black[75]}; | |
| } | |
| `; | |
| export const SearchInput = styled.input` | |
| border: none; | |
| background: transparent; | |
| width: 100%; | |
| padding: 0; | |
| font-family: ${typography.text16Medium.fontFamily}; | |
| font-size: ${typography.text16Medium.fontSize}; | |
| font-weight: ${typography.text16Medium.fontWeight}; | |
| line-height: ${typography.text16Medium.lineHeight}; | |
| color: ${colors.black[75]}; | |
| outline: none; | |
| &::placeholder { | |
| color: ${colors.black[50]}; | |
| } | |
| `; |
π€ Prompt for AI Agents
In `@src/app/agent/style.ts` around lines 77 - 92, The SearchInput styled
component currently uses the same color for the input text and the ::placeholder
(both colors.black[75]); change the placeholder to a lighter shade so users can
distinguish empty state from typed text β update the ::placeholder color in the
SearchInput definition to a lighter token (e.g., colors.black[50]) or
alternatively make the main input color darker, ensuring the placeholder uses a
different color than the input text.
Uh oh!
There was an error while loading. Please reload this page.