Restore Ultracite + fix sidebar (#1233)

This commit is contained in:
Hayden Bleasel 2025-09-21 11:02:31 -07:00 committed by GitHub
parent 8fbfc253fa
commit 947ed094a6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
177 changed files with 6908 additions and 8306 deletions

View file

@ -1,53 +1,49 @@
'use client';
"use client";
import { motion } from 'framer-motion';
import { memo } from 'react';
import type { UseChatHelpers } from '@ai-sdk/react';
import type { VisibilityType } from './visibility-selector';
import type { ChatMessage } from '@/lib/types';
import { Suggestion } from './elements/suggestion';
import type { UseChatHelpers } from "@ai-sdk/react";
import { motion } from "framer-motion";
import { memo } from "react";
import type { ChatMessage } from "@/lib/types";
import { Suggestion } from "./elements/suggestion";
import type { VisibilityType } from "./visibility-selector";
interface SuggestedActionsProps {
type SuggestedActionsProps = {
chatId: string;
sendMessage: UseChatHelpers<ChatMessage>['sendMessage'];
sendMessage: UseChatHelpers<ChatMessage>["sendMessage"];
selectedVisibilityType: VisibilityType;
}
};
function PureSuggestedActions({
chatId,
sendMessage,
selectedVisibilityType,
}: SuggestedActionsProps) {
function PureSuggestedActions({ chatId, sendMessage }: SuggestedActionsProps) {
const suggestedActions = [
'What are the advantages of using Next.js?',
"What are the advantages of using Next.js?",
"Write code to demonstrate Dijkstra's algorithm",
'Help me write an essay about Silicon Valley',
'What is the weather in San Francisco?',
"Help me write an essay about Silicon Valley",
"What is the weather in San Francisco?",
];
return (
<div
data-testid="suggested-actions"
className="grid w-full gap-2 sm:grid-cols-2"
data-testid="suggested-actions"
>
{suggestedActions.map((suggestedAction, index) => (
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, y: 20 }}
transition={{ delay: 0.05 * index }}
initial={{ opacity: 0, y: 20 }}
key={suggestedAction}
transition={{ delay: 0.05 * index }}
>
<Suggestion
suggestion={suggestedAction}
className="h-auto w-full whitespace-normal p-3 text-left"
onClick={(suggestion) => {
window.history.replaceState({}, '', `/chat/${chatId}`);
window.history.replaceState({}, "", `/chat/${chatId}`);
sendMessage({
role: 'user',
parts: [{ type: 'text', text: suggestion }],
role: "user",
parts: [{ type: "text", text: suggestion }],
});
}}
className="h-auto w-full whitespace-normal p-3 text-left"
suggestion={suggestedAction}
>
{suggestedAction}
</Suggestion>
@ -60,10 +56,13 @@ function PureSuggestedActions({
export const SuggestedActions = memo(
PureSuggestedActions,
(prevProps, nextProps) => {
if (prevProps.chatId !== nextProps.chatId) return false;
if (prevProps.selectedVisibilityType !== nextProps.selectedVisibilityType)
if (prevProps.chatId !== nextProps.chatId) {
return false;
}
if (prevProps.selectedVisibilityType !== nextProps.selectedVisibilityType) {
return false;
}
return true;
},
}
);