Skip to content

Commit 83282d7

Browse files
authored
Merge pull request #39 from NillionNetwork/chore/fixes
chore: various fixes
2 parents 98c6431 + 5750490 commit 83282d7

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
lines changed

src/app/app/chat/[id]/page.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ interface ChatPageProps {
1414
}
1515

1616
export default function ChatPage({ params }: ChatPageProps) {
17-
const { selectedPersona, userSecretKeySeed } = useApp();
17+
const { selectedPersona, userSecretKeySeed, setUserSecretKeySeed } = useApp();
1818

1919
// biome-ignore lint/suspicious/noExplicitAny: TODO: add type
2020
const [messages, setMessages] = useState<any[]>([]);
@@ -25,6 +25,15 @@ export default function ChatPage({ params }: ChatPageProps) {
2525
const { user } = useAuth();
2626
const { decryptWithStatus, hasSecretKey } = useEncryption();
2727

28+
// Function to handle updating passphrase
29+
const handleUpdatePassphrase = () => {
30+
// Clear the current passphrase from both context and session storage
31+
setUserSecretKeySeed("");
32+
sessionStorage.removeItem("userSecretKeySeed");
33+
// Open the modal
34+
setShowSecretKeyModal(true);
35+
};
36+
2837
// Track when passphrase has been loaded from session storage
2938
useEffect(() => {
3039
// Check if passphrase exists in session storage
@@ -141,7 +150,7 @@ export default function ChatPage({ params }: ChatPageProps) {
141150
</p>
142151
</div>
143152
<button
144-
onClick={() => setShowSecretKeyModal(true)}
153+
onClick={handleUpdatePassphrase}
145154
className="ml-4 px-4 py-2 bg-[#FFC971] text-black text-sm font-medium rounded-full hover:bg-[#FFD584] transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-[#FFC971]"
146155
>
147156
Update Passphrase

src/components/AttestationModal.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,12 @@ const AttestationModal = () => {
114114
disabled={isLoading}
115115
size="sm"
116116
className="flex items-center gap-2 ml-auto"
117-
data-umami-event="Generate Attestation Clicked"
117+
data-umami-event="Fetch Attestation Clicked"
118118
>
119119
<RefreshCw
120120
className={`w-4 h-4 ${isLoading ? "animate-spin" : ""}`}
121121
/>
122-
Generate
122+
Fetch
123123
</Button>
124124
</div>
125125
</div>

src/components/chat/StreamingChatArea.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -497,14 +497,6 @@ const StreamingChatArea: React.FC<StreamingChatAreaProps> = ({
497497
},
498498
selectedPersona,
499499
);
500-
501-
window.umami.track("Message Sent", {
502-
persona: getPersonaById(selectedPersona)?.name,
503-
...(userMessageAttachments &&
504-
userMessageAttachments.length > 0 && {
505-
attachments: userMessageAttachments,
506-
}),
507-
});
508500
} catch (error) {
509501
console.error("Error:", error);
510502
setMessages((prev) => {
@@ -516,6 +508,14 @@ const StreamingChatArea: React.FC<StreamingChatAreaProps> = ({
516508
return updated;
517509
});
518510
}
511+
512+
window.umami.track("Message Sent", {
513+
persona: getPersonaById(selectedPersona)?.name,
514+
...(userMessageAttachments &&
515+
userMessageAttachments.length > 0 && {
516+
attachments: userMessageAttachments,
517+
}),
518+
});
519519
};
520520

521521
return (

0 commit comments

Comments
 (0)