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

test: stories for supplementary chat messages #401

Merged
merged 6 commits into from
Nov 28, 2024

Conversation

codeincontext
Copy link
Collaborator

  • Extract demo limit message from chat list file, and add a story
  • Extract download buttons from chat list, and add a story
  • Change the paths of some other stories to fit in

Copy link

vercel bot commented Nov 27, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
oak-ai-lesson-assistant ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 28, 2024 2:08pm

Copy link

github-actions bot commented Nov 27, 2024

Playwright test results

passed  14 passed
flaky  1 flaky
skipped  1 skipped

Details

report  Open report ↗︎
stats  16 tests across 15 suites
duration  2 minutes, 44 seconds
commit  64bd15a

Flaky tests

No persona › tests/modifiy-lesson.test.ts › Modify a lesson plan › Modify a lesson resource

Skipped tests

No persona › tests/auth.test.ts › authenticate through Clerk UI

@codeincontext codeincontext requested review from mikeritson-oak and a team November 28, 2024 14:01
@@ -45,7 +45,6 @@ export const decorators: Decorator[] = [
ClerkDecorator,
(Story) => (
<>
{/* TODO: Mock tRPC calls with MSW */}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are doing this now

Comment on lines -26 to -43
function DemoLimitMessage({ id }: Readonly<{ id: string }>) {
return (
<div className="w-full flex-col gap-11">
<ChatMessage
chatId={id}
ailaStreamingStatus="Idle"
message={{
id: "demo-limit",
role: "assistant",
content:
'{"type": "error", "message": "**Your lesson is complete**\\nYou can no longer edit this lesson. [Create new lesson.](/aila)"}',
}}
persistedModerations={[]}
separator={<span className="my-10 flex" />}
/>
</div>
);
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extracted to a new file and story

Comment on lines -236 to -298
const InChatDownloadButtons = ({
demo,
id,
setDialogWindow,
}: {
readonly demo: DemoContextProps;
readonly id: string;
readonly setDialogWindow: Dispatch<SetStateAction<DialogTypes>>;
}) => {
return (
<OakFlex $flexDirection="column" $gap="all-spacing-7" $mv="space-between-l">
{demo.isSharingEnabled && (
<Link
href={demo.isSharingEnabled ? `/aila/download/${id}` : "#"}
onClick={() => {
if (!demo.isSharingEnabled) {
setDialogWindow("demo-share-locked");
}
}}
>
<InnerInChatButton iconName="download">Download</InnerInChatButton>
</Link>
)}
<button
onClick={() => {
if (demo.isSharingEnabled) {
setDialogWindow("share-chat");
} else {
setDialogWindow("demo-share-locked");
}
}}
>
<InnerInChatButton iconName="share">Share</InnerInChatButton>
</button>
</OakFlex>
);
};

const InnerInChatButton = ({
iconName,

children,
}: {
readonly iconName: "download" | "share";

readonly children: string;
}) => {
return (
<OakFlex
$pa="inner-padding-m"
$gap="all-spacing-3"
$background="white"
$borderRadius="border-radius-m"
$alignItems="center"
$dropShadow="drop-shadow-standard"
>
<OakBox $transform="scale">
<OakIcon iconName={iconName} $width="all-spacing-7" />
</OakBox>
<OakSpan $font="body-2">{children}</OakSpan>
</OakFlex>
);
};
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extracted to a new file and story

Copy link

Copy link
Collaborator

@mikeritson-oak mikeritson-oak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chromatic looks good. 👍

@@ -3,7 +3,7 @@ import type { Meta, StoryObj } from "@storybook/react";
import { ChatStartForm } from "./chat-start-form";

const meta: Meta<typeof ChatStartForm> = {
title: "Components/Chat/ChatStartForm",
title: "Components/Chat Start/ChatStartForm",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that path meant to have a gap? Chat Start

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for checking. This is only used in the storybook UI so it does look right there

@codeincontext codeincontext merged commit 91e2291 into main Nov 28, 2024
22 checks passed
@codeincontext codeincontext deleted the test/chat-message-stories branch November 28, 2024 17:33
@oak-machine-user
Copy link
Collaborator

🎉 This PR is included in version 1.17.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants