Skip to content

Commit

Permalink
feat: improve interface for chat integration
Browse files Browse the repository at this point in the history
  • Loading branch information
astappiev committed Dec 18, 2024
1 parent 7914670 commit 9d53086
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/java/de/l3s/learnweb/search/SearchChatBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class SearchChatBean extends ApplicationBean implements Serializable {

public void onLoad() throws InterwebException {
BeanAssert.authorized(isLoggedIn());
BeanAssert.hasPermission(getUser().isModerator() || getUserBean().isSearchChatEnabled());
BeanAssert.hasPermission(getUser().isAdmin() || getUserBean().isSearchChatEnabled());
interweb = getLearnweb().getInterweb();
promptSurveyId = getUser().getOrganisation().getSettings().getIntValue(Settings.chat_feedback_prompt_survey_page_id);
responseSurveyId = getUser().getOrganisation().getSettings().getIntValue(Settings.chat_feedback_response_survey_page_id);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/de/l3s/learnweb/user/UserBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ private static BaseMenuModel createMenuModel(ResourceBundle msg, User user) {
.addElement(DefaultMenuItem.builder().value(msg.getString("text_analysis")).icon("fas fa-spell-check").url("admin/text_analysis.jsf").build())
.addElement(DefaultMenuItem.builder().value(msg.getString("statistics")).icon("fas fa-chart-line").url("admin/statistics.jsf").build())
.addElement(DefaultMenuItem.builder().value(msg.getString("transcript")).icon("fas fa-language").url("admin/transcript.jsf").build())
.addElement(DefaultMenuItem.builder().value(msg.getString("llm_chat_history")).icon("fas fa-hat-wizard").url("admin/chat-history.jsf").build())
.addElement(DefaultMenuItem.builder().value(msg.getString("glossary_dashboard")).icon("fas fa-chart-bar").url("dashboard/glossary.jsf").build())
.addElement(DefaultMenuItem.builder().value(msg.getString("activity.dashboard")).icon("fas fa-chart-line").url("dashboard/activity.jsf").build())
.addElement(DefaultMenuItem.builder().value(msg.getString("dashboard.tracker")).icon("fas fa-mouse-pointer").url("dashboard/tracker.jsf").build())
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/de/l3s/learnweb/lang/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1694,3 +1694,6 @@ your_info.sent_messages_msg = You have sent {0} messages
your_info.sent_msgs = Sent messages
your_information = Your information
llm_chat_history = Chat history
llm_chat = Chat with a Bot
3 changes: 3 additions & 0 deletions src/main/webapp/WEB-INF/templates/layout/parts/header.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
xmlns:f="jakarta.faces.core"
xmlns:h="jakarta.faces.html"
xmlns:ui="jakarta.faces.facelets"
xmlns:faces="jakarta.faces"
xmlns:p="http://primefaces.org/ui">

<nav class="navbar sticky-top navbar-main navbar-dark bg-primary shadow">
Expand All @@ -27,6 +28,8 @@
<p:inputText id="searchfield" placeholder="#{msg.searchLabel}" type="search" autocomplete="off"/>
<p:commandButton title="#{msg.searchLabel}" icon="fas fa-search"
onclick="window.location.href = 'search.jsf?query=' + $('#navbar_form\\:searchfield').val();return false;"/>
<p:commandButton title="#{msg.llm_chat}" icon="fas fa-comment-dots"
onclick="window.location.href = 'search/chat.jsf?query=' + $('#navbar_form\\:searchfield').val();return false;"/>
</div>

<ul class="navbar-nav ms-auto">
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/lw/search.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<f:param name="query" value="#{searchBean.query}"/>
</h:link>
</li>
<li class="filter" faces:rendered="#{userBean.searchChatEnabled}">
<li class="filter" faces:rendered="#{userBean.admin or userBean.searchChatEnabled}">
<h:link outcome="search/chat">
<span class="filter-title">
<span class="text-truncate">#{msg.chat}</span>
Expand Down
11 changes: 10 additions & 1 deletion src/main/webapp/resources/learnweb/sass/layouts/_header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,25 @@ $topbar-button-padding: 1rem;

button {
border: 0 !important;
border-radius: 0 var(--border-radius) var(--border-radius) 0;
border-radius: 0;
display: flex;
align-items: center;
background: var(--secondary-bg);
color: var(--secondary-text-emphasis);
margin: 0 !important;

&.ui-button-icon-only .ui-button-text {
padding: 0.3rem;
}

&:hover {
background: $primaryDarkColor;
color: $primaryTextColor;
}

&:last-child {
border-radius: 0 var(--border-radius) var(--border-radius) 0;
}
}
}

Expand Down

0 comments on commit 9d53086

Please sign in to comment.