Skip to content

Commit

Permalink
chore(wren-ui): hide regenerate button if there are any recommended q…
Browse files Browse the repository at this point in the history
…uestions on the UI
  • Loading branch information
fredalai committed Nov 27, 2024
1 parent 864ae3a commit c9d41b1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useState, useMemo } from 'react';
import styled from 'styled-components';
import { ButtonProps, Space, Button, Row, Col } from 'antd';
import { Space, Button, Row, Col } from 'antd';
import ColumnHeightOutlined from '@ant-design/icons/ColumnHeightOutlined';
import MinusOutlined from '@ant-design/icons/MinusOutlined';
import EllipsisWrapper from '@/components/EllipsisWrapper';
Expand Down Expand Up @@ -31,7 +31,6 @@ const MAX_EXPANDED_QUESTIONS = 9;
interface Props {
onSelect: (payload: { sql: string; question: string }) => void;
recommendedQuestions: GroupedQuestion[];
buttonProps: ButtonProps;
}

const QuestionTemplate = ({ category, sql, question, onSelect }) => {
Expand All @@ -55,7 +54,7 @@ const QuestionTemplate = ({ category, sql, question, onSelect }) => {
const QuestionColumnIterator = makeIterable(QuestionTemplate);

export default function RecommendedQuestionsPrompt(props: Props) {
const { onSelect, recommendedQuestions, buttonProps } = props;
const { onSelect, recommendedQuestions } = props;

const [isExpanded, setIsExpanded] = useState<boolean>(false);

Expand All @@ -72,15 +71,14 @@ export default function RecommendedQuestionsPrompt(props: Props) {

return (
<div className="bg-gray-2 px-10 py-6">
<div className="d-flex align-center mb-3 justify-space-between">
<div className="d-flex align-center mb-3">
<Logo size={24} color="var(--gray-8)" />
<div className="text-md text-medium gray-8 mx-3">
Know more about your data.
</div>
<div className="text-medium gray-7">
Try asking some of the following questions
</div>
<Button className="ml-3" {...buttonProps} />
</div>
<Space
style={{ width: 680 }}
Expand Down
1 change: 1 addition & 0 deletions wren-ui/src/hooks/useRecommendedQuestionsInstruction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ export default function useRecommendedQuestionsInstruction() {
};

if (showRecommendedQuestionsPromptMode && isRegenerate) {
// The cost of generating recommend questions is too high, so we still return button pops, but the button will not show on the UI now.
return {
...baseProps,
icon: <ReloadOutlined />,
Expand Down
1 change: 0 additions & 1 deletion wren-ui/src/pages/home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ function RecommendedQuestionsInstruction(props) {
<RecommendedQuestionsPrompt
recommendedQuestions={recommendedQuestions}
onSelect={onSelect}
buttonProps={buttonProps}
/>
<div className="py-12" />
</div>
Expand Down

0 comments on commit c9d41b1

Please sign in to comment.