Skip to content

Commit

Permalink
Minor UI fix (#168)
Browse files Browse the repository at this point in the history
* modified label.ask_me in or

* fixed history api call and example question font size
  • Loading branch information
prtkjakhar authored Sep 14, 2023
1 parent 0052a3c commit f59e057
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 29 deletions.
31 changes: 3 additions & 28 deletions apps/amakrushi/src/components/HistoryPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ const HistoryPage: NextPage = () => {
const flags = useFlags(['show_chat_history_page']);
const t = useLocalization();
const [gettingHistory, setGettingHistory] = useState(false);
const [currentPage, setCurrentPage] = useState(1);
const [totalPages, setTotalPages] = useState(1);

useEffect(() => {
//@ts-ignore
Expand All @@ -32,19 +30,14 @@ const HistoryPage: NextPage = () => {
setGettingHistory(true);

axios
.get(`${process.env.NEXT_PUBLIC_BASE_URL}/user/conversations`, {
.get(`${process.env.NEXT_PUBLIC_BASE_URL}/user/conversations/all`, {
headers: {
authorization: `Bearer ${localStorage.getItem('auth')}`,
},
params: {
page: currentPage,
perPage: 10,
},
})
.then((res) => {
setTotalPages(res?.data?.pagination?.totalPages);
const sortedConversations = _.filter(
res?.data?.userHistory,
res?.data,
(conv) => conv?.conversationId !== null
).sort(
//@ts-ignore
Expand All @@ -61,12 +54,8 @@ const HistoryPage: NextPage = () => {
});
setGettingHistory(false);
});
}, [currentPage]);
}, []);

const handlePageChange = (newPage: number) => {
console.log("New Page:", newPage);
setCurrentPage(newPage);
};

// Function to delete conversation by conversationId
const deleteConversationById = useCallback(
Expand Down Expand Up @@ -163,20 +152,6 @@ const HistoryPage: NextPage = () => {
<p>{t('message.no_history')}</p>
</div>
)}
{/* Pagination Controls */}
{conversations.length > 0 && !gettingHistory && <div className={styles.pagination}>
<button
onClick={() => {setConversations([]); handlePageChange(currentPage - 1)}}
disabled={currentPage === 1}>
<Image src={leftArrow} alt="left" width={50} height={50} />
</button>
<p>{currentPage} / {totalPages}</p>
<button
onClick={() => {setConversations([]); handlePageChange(currentPage + 1)}}
disabled={currentPage === totalPages}>
<Image src={rightArrow} alt="right" width={50} height={50} />
</button>
</div>}
</div>
</div>
<Menu />
Expand Down
2 changes: 1 addition & 1 deletion apps/amakrushi/src/components/HomePage/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
width: calc(100vw - 50px);
padding: 1vh;
text-align: left;
font-size: 2vh;
font-size: 14px;
font-weight: bold;
}

Expand Down

0 comments on commit f59e057

Please sign in to comment.