Merge pull request 'New and improved buttons for the history' (#124) from sageTheDm/interstellar_ai:main into main

Reviewed-on: https://interstellardevelopment.org/code/code/React-Group/interstellar_ai/pulls/124
This commit is contained in:
Patrick 2024-10-09 13:31:52 +02:00
commit bee54bbd29
2 changed files with 57 additions and 14 deletions

View file

@ -34,23 +34,30 @@ const History: React.FC = () => {
{/* Populate with history items */}
{chatHistory.chats.map((chats, index) => (
<li key={index}>
<a href="#" onClick={() => handleHistoryClick(index)}>{chatHistory.chats[index].name}</a>
<a href="#" onClick={() => handleHistoryClick(index)}>
{chatHistory.chats[index].name}
</a>
</li>
))}
<li>
{isEditing ? (
<div>
<input
type="text"
value={inputValue}
onChange={handleInputChange}
placeholder="Enter text"
/>
<button onClick={handleSaveButtonClick}>Save</button>
</div>
) : (
<button onClick={handleEditButtonClick}>{'New Chat'}</button>
)}
<div className="input-container">
<input
type="text"
value={inputValue}
onChange={handleInputChange}
placeholder="Enter text"
className="chat-input"
/>
<button onClick={handleSaveButtonClick} className="save-btn">
Save
</button>
</div>
) : (
<button onClick={handleEditButtonClick} className="newChat-btn">
New Chat
</button>
)}
</li>
</ul>
</div>

View file

@ -37,3 +37,39 @@
height: 86dvh;
/* padding-bottom: 3dvh; */
}
.input-container {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
}
.chat-input {
border-color: var(--input-border-color);
color: var(--text-color);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
padding: 10px;
border-radius: 5px;
width: 80%;
height: 50px;
box-sizing: border-box;
line-height: 30px;
}
.save-btn, .newChat-btn {
display: flex;
justify-content: center;
align-items: center;
text-align: center;
width: 20%;
height: 50px;
background-color: var(--input-button-color);
color: var(--text-color);
border: none;
font-size: 0.9em;
border-radius: 5px;
margin-left: 10px;
}
.newChat-btn{
margin-left: 0px;
}