Skip to content

Commit

Permalink
fix janhq#283: small ui fixes (janhq#299)
Browse files Browse the repository at this point in the history
Signed-off-by: James <[email protected]>
Co-authored-by: James <[email protected]>
namchuai and James authored Oct 8, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 780ec5c commit 70202cc
Showing 7 changed files with 21 additions and 17 deletions.
4 changes: 2 additions & 2 deletions web/app/_components/ConfirmDeleteConversationModal/index.tsx
Original file line number Diff line number Diff line change
@@ -63,8 +63,8 @@ const ConfirmDeleteConversationModal: React.FC = () => {
<div className="mt-2">
<p className="text-sm text-gray-500">
Are you sure you want to delete this conversation? All
of messages will be permanently removed from our servers
forever. This action cannot be undone.
of messages will be permanently removed. This action
cannot be undone.
</p>
</div>
</div>
2 changes: 1 addition & 1 deletion web/app/_components/LoginButton/index.tsx
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ const LoginButton: React.FC = () => {
// <button
// onClick={signInWithKeyCloak}
// type="button"
// className="rounded-md bg-indigo-600 px-2.5 py-1.5 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
// className="rounded-md bg-blue-600 px-2.5 py-1.5 text-sm font-semibold text-white shadow-sm hover:bg-blue-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600"
// >
// Login
// </button>
12 changes: 6 additions & 6 deletions web/app/_components/ModelSelector/index.tsx
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ const SelectModels: React.FC = () => {
Select a Model:
</Listbox.Label>
<div className="relative mt-[19px]">
<Listbox.Button className="relative w-full cursor-default rounded-md bg-white py-1.5 pl-3 pr-10 text-left text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:outline-none focus:ring-2 focus:ring-indigo-500 sm:text-sm sm:leading-6">
<Listbox.Button className="relative w-full cursor-default rounded-md bg-white py-1.5 pl-3 pr-10 text-left text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 sm:text-sm sm:leading-6">
<span className="flex items-center">
<img
src={selectedModel.avatarUrl}
@@ -68,8 +68,8 @@ const SelectModels: React.FC = () => {
key={model.id}
className={({ active }) =>
classNames(
active ? "bg-indigo-600 text-white" : "text-gray-900",
"relative cursor-default select-none py-2 pl-3 pr-9"
active ? "bg-blue-600 text-white" : "text-gray-900",
"relative cursor-default select-none py-2 pl-3 pr-9",
)
}
value={model}
@@ -85,7 +85,7 @@ const SelectModels: React.FC = () => {
<span
className={classNames(
selected ? "font-semibold" : "font-normal",
"ml-3 block truncate"
"ml-3 block truncate",
)}
>
{model.name}
@@ -95,8 +95,8 @@ const SelectModels: React.FC = () => {
{selected ? (
<span
className={classNames(
active ? "text-white" : "text-indigo-600",
"absolute inset-y-0 right-0 flex items-center pr-4"
active ? "text-white" : "text-blue-600",
"absolute inset-y-0 right-0 flex items-center pr-4",
)}
>
<CheckIcon className="h-5 w-5" aria-hidden="true" />
2 changes: 1 addition & 1 deletion web/app/_components/PrimaryButton/index.tsx
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ const PrimaryButton: React.FC<Props> = ({
<button
onClick={onClick}
type="button"
className={`rounded-md bg-indigo-500 px-3.5 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-indigo-400 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-50 line-clamp-1 flex-shrink-0 ${className} ${
className={`rounded-md bg-blue-500 px-3.5 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-blue-400 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-50 line-clamp-1 flex-shrink-0 ${className} ${
fullWidth ? "flex-1 " : ""
}}`}
>
2 changes: 1 addition & 1 deletion web/app/_components/SendButton/index.tsx
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ const SendButton: React.FC = () => {
onClick={sendChatMessage}
style={disabled ? disabledStyle : enabledStyle}
type="submit"
className="p-2 gap-2.5 inline-flex items-center rounded-xl text-sm font-semibold shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
className="p-2 gap-2.5 inline-flex items-center rounded-xl text-sm font-semibold shadow-sm hover:bg-blue-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600"
>
<ArrowRightIcon width={16} height={16} />
</button>
2 changes: 1 addition & 1 deletion web/app/_components/SimpleTextMessage/index.tsx
Original file line number Diff line number Diff line change
@@ -53,7 +53,7 @@ const SimpleTextMessage: React.FC<Props> = ({
</div>
))
) : (
<span className="text-sm">{text}</span>
<span className="text-sm leading-loose font-normal">{text}</span>
)}
</div>
</div>
14 changes: 9 additions & 5 deletions web/app/_hooks/useDeleteConversation.ts
Original file line number Diff line number Diff line change
@@ -19,12 +19,13 @@ import {

export default function useDeleteConversation() {
const [userConversations, setUserConversations] = useAtom(
userConversationsAtom
userConversationsAtom,
);
const setCurrentPrompt = useSetAtom(currentPromptAtom);
const setShowingProductDetail = useSetAtom(showingProductDetailAtom);
const setShowingAdvancedPrompt = useSetAtom(showingAdvancedPromptAtom);
const activeConvoId = useAtomValue(getActiveConvoIdAtom);

const setActiveConvoId = useSetAtom(setActiveConvoIdAtom);
const deleteMessages = useSetAtom(deleteConversationMessage);
const setMainViewState = useSetAtom(setMainViewStateAtom);
@@ -34,14 +35,17 @@ export default function useDeleteConversation() {
try {
await execute(DataService.DELETE_CONVERSATION, activeConvoId);
const currentConversations = userConversations.filter(
(c) => c.id !== activeConvoId
(c) => c.id !== activeConvoId,
);
setUserConversations(currentConversations);
if (currentConversations.length === 0) {
deleteMessages(activeConvoId);

if (currentConversations.length > 0) {
setActiveConvoId(currentConversations[0].id);
} else {
setMainViewState(MainViewState.Welcome);
setActiveConvoId(undefined);
}
deleteMessages(activeConvoId);
setActiveConvoId(undefined);
setCurrentPrompt("");
setShowingProductDetail(false);
setShowingAdvancedPrompt(false);

0 comments on commit 70202cc

Please sign in to comment.