Skip to content
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

Add support for resuming user's login intention #173

Merged
merged 75 commits into from
Mar 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
e9b5862
Add dummy user intension triggers
e32wong Mar 13, 2025
f6f6222
Move route guards to its own composition file
e32wong Mar 17, 2025
2d290f1
Move guard variables inside the composable
e32wong Mar 17, 2025
77c4c42
Add the shared route guard to comment composer
e32wong Mar 17, 2025
d3a56ba
Add a custom login confirmation dialog for user intention
e32wong Mar 18, 2025
7c4fc65
Revise user intention model
e32wong Mar 18, 2025
381565c
Complete the user intention loop for user opinions
e32wong Mar 18, 2025
c58a1b0
feat: first version of LLM support
nicobao Mar 18, 2025
19bba1b
Add feedback on user intention resumation after login
e32wong Mar 19, 2025
4b4a59b
Fix intention state bug
e32wong Mar 19, 2025
104104a
Add support for new conversation user intention resume
e32wong Mar 19, 2025
7b6361c
Add dummy user intension triggers
e32wong Mar 13, 2025
dcaf681
Move route guards to its own composition file
e32wong Mar 17, 2025
da567d0
Move guard variables inside the composable
e32wong Mar 17, 2025
b089356
Add the shared route guard to comment composer
e32wong Mar 17, 2025
b78f0ad
Add a custom login confirmation dialog for user intention
e32wong Mar 18, 2025
a6e7c2c
Revise user intention model
e32wong Mar 18, 2025
7054ca1
Complete the user intention loop for user opinions
e32wong Mar 18, 2025
7b39177
Add feedback on user intention resumation after login
e32wong Mar 19, 2025
784539a
Fix intention state bug
e32wong Mar 19, 2025
2972366
Add support for new conversation user intention resume
e32wong Mar 19, 2025
e36e6c9
Merge branch '18' of github.com:e32wong/agora into 18
e32wong Mar 19, 2025
9ad018e
Fix conversation object with deep structured clone
e32wong Mar 19, 2025
e8534fe
fix: following tests in staging
nicobao Mar 19, 2025
448004f
fix(llm): properly send prompt variable
nicobao Mar 19, 2025
697347e
Add dummy user intension triggers
e32wong Mar 13, 2025
0e9845b
Move route guards to its own composition file
e32wong Mar 17, 2025
47680cf
Move guard variables inside the composable
e32wong Mar 17, 2025
3a127f3
Add the shared route guard to comment composer
e32wong Mar 17, 2025
b60eb0f
Add a custom login confirmation dialog for user intention
e32wong Mar 18, 2025
43a3515
Revise user intention model
e32wong Mar 18, 2025
3a69a86
Complete the user intention loop for user opinions
e32wong Mar 18, 2025
62442e7
Add feedback on user intention resumation after login
e32wong Mar 19, 2025
36bc8ce
Fix intention state bug
e32wong Mar 19, 2025
e066de0
Add support for new conversation user intention resume
e32wong Mar 19, 2025
a2417b0
Fix conversation object with deep structured clone
e32wong Mar 19, 2025
1f7ddc2
Merge branch '18' of github.com:e32wong/agora into 18
e32wong Mar 19, 2025
081626e
fix(llm): prompt management doens't work for mistral + only run if 2
nicobao Mar 19, 2025
3a30fdb
fix(front): update opinion categorization dynamically
nicobao Mar 20, 2025
b919c0c
fix(llm-polis): improve logging for debugging
nicobao Mar 20, 2025
c4589b1
Fix the clearing old user intentions
e32wong Mar 20, 2025
63560e7
Apply intention module fixes
e32wong Mar 20, 2025
75fdd51
Add fix the Quasar dialog force close bug
e32wong Mar 20, 2025
6589701
Replace the report content menu's login dialog with the new custom di…
e32wong Mar 20, 2025
262e481
feat(llm): first version that works
nicobao Mar 20, 2025
27fd47d
fix(llm): add label to menu too
nicobao Mar 20, 2025
52c9b78
Fix conversation sorting button's line height (#174)
e32wong Mar 21, 2025
9f3fd9d
Add dummy user intension triggers
e32wong Mar 13, 2025
992339a
Move route guards to its own composition file
e32wong Mar 17, 2025
901ed4b
Move guard variables inside the composable
e32wong Mar 17, 2025
0b86c1e
Add the shared route guard to comment composer
e32wong Mar 17, 2025
9b18121
Add a custom login confirmation dialog for user intention
e32wong Mar 18, 2025
b568b66
Revise user intention model
e32wong Mar 18, 2025
5759243
Complete the user intention loop for user opinions
e32wong Mar 18, 2025
2728004
Add feedback on user intention resumation after login
e32wong Mar 19, 2025
c04af96
Fix intention state bug
e32wong Mar 19, 2025
9210445
Add support for new conversation user intention resume
e32wong Mar 19, 2025
8401aab
Fix conversation object with deep structured clone
e32wong Mar 19, 2025
d3ffc07
Fix the clearing old user intentions
e32wong Mar 20, 2025
0b24287
Apply intention module fixes
e32wong Mar 20, 2025
9821c86
Add fix the Quasar dialog force close bug
e32wong Mar 20, 2025
5bc75da
Replace the report content menu's login dialog with the new custom di…
e32wong Mar 20, 2025
993da58
Merge branch '18' of github.com:e32wong/agora into 18
e32wong Mar 21, 2025
549736c
Simplify the post login dialog by mounting it on the layout file
e32wong Mar 21, 2025
5f05fc1
Improve the opinion highlighting to use just the border
e32wong Mar 21, 2025
829c658
Add support for voting intention
e32wong Mar 21, 2025
2a6e210
Integrate user redirection for content reporting
e32wong Mar 21, 2025
f614297
Orgnaize component file structure
e32wong Mar 21, 2025
acbd028
Add a user successful login check for user intention
e32wong Mar 21, 2025
c721bfa
Optimize the loading for conversations from the intention restoration
e32wong Mar 22, 2025
7f3a53f
Fix conversation draft's intention restoration bug where deep clone is
e32wong Mar 22, 2025
6d40230
Adjust dialog messages
e32wong Mar 22, 2025
d62494d
Remove unneeded await
e32wong Mar 22, 2025
31efeb2
Fix conversation page's back button to use the custom route system
e32wong Mar 22, 2025
d33715c
Disable intention dialog dismiss from route changes
e32wong Mar 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<template>
<div>
<q-dialog v-model="showDialog" no-route-dismiss>
<div class="cardStyle">
<div class="title">
{{ title }}
</div>

<div v-if="message">
{{ message }}
</div>

<slot name="body" />

<div class="actionButtons">
<ZKButton
v-if="showCancelDialog"
button-type="largeButton"
label="Cancel"
@click="showDialog = false"
/>
<ZKButton
button-type="largeButton"
label="Ok"
color="primary"
@click="clickedOkButton()"
/>
</div>
</div>
</q-dialog>
</div>
</template>

<script setup lang="ts">
import ZKButton from "src/components/ui-library/ZKButton.vue";

const props = defineProps<{
title: string;
message: string;
showCancelDialog: boolean;
okCallback: () => void;
}>();

const showDialog = defineModel<boolean>({ required: true });

function clickedOkButton() {
props.okCallback();
}
</script>

<style lang="scss" scoped>
.cardStyle {
display: flex;
flex-direction: column;
gap: 1rem;
background-color: white;
border-radius: 25px;
max-width: 25rem;
min-width: 5rem;
padding: 1.5rem;
}

.title {
font-size: 1.3rem;
font-weight: 500;
}

.actionButtons {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: flex-end;
gap: 1rem;
padding-top: 1rem;
}
</style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<template>
<div>
<DialogContainer
v-model="showDialog"
:title="'Session resumed'"
:message="''"
:show-cancel-dialog="false"
:ok-callback="okCallback"
>
<template #body>
{{ message }}
</template>
</DialogContainer>
</div>
</template>

<script setup lang="ts">
import { onMounted, ref, watch } from "vue";
import { useLoginIntentionStore } from "src/stores/loginIntention";
import { storeToRefs } from "pinia";
import DialogContainer from "./DialogContainer.vue";

const { showPostLoginIntentionDialog, activeUserIntention } = storeToRefs(
useLoginIntentionStore()
);
const { setActiveUserIntention, composePostLoginDialogMessage } =
useLoginIntentionStore();

const message = ref("");

const showDialog = ref(false);

onMounted(() => {
checkData();
});

watch(showPostLoginIntentionDialog, () => {
checkData();
});

function checkData() {
if (showPostLoginIntentionDialog.value == true) {
message.value = composePostLoginDialogMessage(activeUserIntention.value);
showDialog.value = true;
}
}

function okCallback() {
showPostLoginIntentionDialog.value = false;
showDialog.value = false;
setActiveUserIntention("none");
}
</script>

<style lang="scss" scoped>
.cardStyle {
display: flex;
flex-direction: column;
gap: 1rem;
background-color: white;
border-radius: 25px;
max-width: 20rem;
padding: 1.5rem;
}
</style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<template>
<div>
<DialogContainer
v-model="showDialog"
:title="'Log in to Agora'"
:message="'Sign in to participate the discussions'"
:show-cancel-dialog="true"
:ok-callback="okButtonClicked"
>
<template #body>
<div v-if="subMessage" class="shadowBoxStyle">
<div class="iconAlignment">
<q-icon name="mdi-information" size="1.2rem" />
</div>
<div>
{{ subMessage }}
</div>
</div>
</template>
</DialogContainer>
</div>
</template>

<script setup lang="ts">
import { ref } from "vue";
import {
PossibleIntentions,
useLoginIntentionStore,
} from "src/stores/loginIntention";
import { useRouter } from "vue-router";
import DialogContainer from "./DialogContainer.vue";

const showDialog = defineModel<boolean>({ required: true });

const props = defineProps<{
okCallback: () => void;
activeIntention: PossibleIntentions;
}>();

const { composeLoginIntentionDialogMessage, setActiveUserIntention } =
useLoginIntentionStore();

const subMessage = ref(
composeLoginIntentionDialogMessage(props.activeIntention)
);

const router = useRouter();

async function okButtonClicked() {
props.okCallback();
setActiveUserIntention(props.activeIntention);
await router.push({ name: "/welcome/" });
}
</script>

<style scoped lang="scss">
.shadowBoxStyle {
display: grid;
grid-template-columns: auto auto;
grid-template-rows: 1fr;
gap: 0px 1rem;
grid-template-areas: ". .";
padding: 0.5rem;
color: $primary;
}

.iconAlignment {
margin: auto;
}
</style>
32 changes: 18 additions & 14 deletions services/agora/src/components/navigation/SideDrawer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,22 @@
</div>

<div>
<div
v-if="drawerBehavior == 'desktop'"
class="bottomSection startConversationButton"
@click="requestNewPost()"
>
<img :src="newConversationButton" />
</div>
<RouterLink :to="{ name: '/conversation/create/' }">
<div
v-if="drawerBehavior == 'desktop'"
class="bottomSection startConversationButton"
>
<img :src="newConversationButton" />
</div>
</RouterLink>
</div>
</div>

<PreLoginIntentionDialog
v-model="showLoginDialog"
:ok-callback="() => {}"
:active-intention="'none'"
/>
</div>
</template>

Expand All @@ -70,16 +77,13 @@ import { RouteMap, useRoute, useRouter } from "vue-router";
import ZKHoverEffect from "../ui-library/ZKHoverEffect.vue";
import { storeToRefs } from "pinia";
import { useAuthenticationStore } from "src/stores/authentication";
import { useDialog } from "src/utils/ui/dialog";
import UserAvatar from "../account/UserAvatar.vue";
import { useUserStore } from "src/stores/user";
import { useNavigationStore } from "src/stores/navigation";
import { ref, watch } from "vue";
import { useCreateNewPost } from "src/utils/component/conversation/newPost";
import ZKStyledIcon from "../ui-library/ZKStyledIcon.vue";
import NewNotificationIndicator from "../notification/NewNotificationIndicator.vue";

const { requestNewPost } = useCreateNewPost();
import PreLoginIntentionDialog from "../authentication/intention/PreLoginIntentionDialog.vue";

const newConversationButton =
process.env.VITE_PUBLIC_DIR + "/images/conversation/newConversationLong.svg";
Expand All @@ -93,11 +97,11 @@ const drawerIconLogo1 =
const drawerIconLogo2 =
process.env.VITE_PUBLIC_DIR + "/images/icons/agora-text.svg";

const { showLoginConfirmationDialog } = useDialog();

const router = useRouter();
const route = useRoute();

const showLoginDialog = ref(false);

interface SettingItem {
icon: string;
name: string;
Expand Down Expand Up @@ -170,7 +174,7 @@ function initializeMenu() {

async function enterRoute(routeName: keyof RouteMap, requireAuth: boolean) {
if (requireAuth && isAuthenticated.value == false) {
showLoginConfirmationDialog();
showLoginDialog.value = true;
} else {
if (drawerBehavior.value == "mobile") {
showMobileDrawer.value = false;
Expand Down
15 changes: 11 additions & 4 deletions services/agora/src/components/navigation/footer/FooterBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,32 @@
</div>
</div>
</div>

<PreLoginIntentionDialog
v-model="showLoginDialog"
:ok-callback="() => {}"
:active-intention="'none'"
/>
</div>
</template>

<script setup lang="ts">
import { storeToRefs } from "pinia";
import PreLoginIntentionDialog from "src/components/authentication/intention/PreLoginIntentionDialog.vue";
import NewNotificationIndicator from "src/components/notification/NewNotificationIndicator.vue";
import ZKStyledIcon from "src/components/ui-library/ZKStyledIcon.vue";
import ZKStyledText from "src/components/ui-library/ZKStyledText.vue";
import { useAuthenticationStore } from "src/stores/authentication";
import { useDialog } from "src/utils/ui/dialog";
import { ref } from "vue";
import { useRoute, useRouter } from "vue-router";

const { isAuthenticated } = storeToRefs(useAuthenticationStore());

const dialog = useDialog();

const route = useRoute();
const router = useRouter();

const showLoginDialog = ref(false);

async function accessHomeFeed() {
if (route.name == "/") {
window.scrollTo({ top: 0, behavior: "smooth" });
Expand All @@ -65,7 +72,7 @@ async function accessHomeFeed() {

async function accessNotifications() {
if (!isAuthenticated.value) {
dialog.showLoginConfirmationDialog();
showLoginDialog.value = true;
} else {
await router.push({ name: "/notification/" });
}
Expand Down
Loading