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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gen AI lab: styling pass #58004

Merged
merged 6 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 18 additions & 17 deletions apps/src/aichat/views/AichatView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,6 @@ import {AichatLevelProperties, ViewMode} from '@cdo/apps/aichat/types';
import {isProjectTemplateLevel} from '@cdo/apps/lab2/lab2Redux';
import ProjectTemplateWorkspaceIcon from '@cdo/apps/templates/ProjectTemplateWorkspaceIcon';

const renderChatWorkspaceHeaderRight = (onClear: () => void) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tired of seeing helpers at the top of React components, so moved to bottom :)

return (
<div>
<Button
onClick={onClear}
text="Clear"
iconLeft={{iconName: 'paintbrush'}}
size="xs"
color="white"
type="secondary"
/>
<CopyButton />
</div>
);
};

const AichatView: React.FunctionComponent = () => {
const [viewMode, setViewMode] = useState<string>(ViewMode.EDIT);
const dispatch = useAppDispatch();
Expand Down Expand Up @@ -92,7 +76,7 @@ const AichatView: React.FunctionComponent = () => {
},
},
],
size: 'm',
size: 's',
selectedButtonValue: viewMode,
onChange: setViewMode,
};
Expand Down Expand Up @@ -162,4 +146,21 @@ const AichatView: React.FunctionComponent = () => {
);
};

const renderChatWorkspaceHeaderRight = (onClear: () => void) => {
return (
<div className={moduleStyles.chatHeaderRight}>
<Button
onClick={onClear}
text="Clear"
iconLeft={{iconName: 'paintbrush'}}
size="xs"
color="white"
type="secondary"
className={moduleStyles.clearButton}
/>
<CopyButton />
</div>
);
};

export default AichatView;
14 changes: 7 additions & 7 deletions apps/src/aichat/views/CopyButton.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import {useSelector} from 'react-redux';

import Button from '@cdo/apps/templates/Button';
import Button from '@cdo/apps/componentLibrary/button/Button';
import copyToClipboard from '@cdo/apps/util/copyToClipboard';
import {AichatState} from '@cdo/apps/aichat/redux/aichatRedux';

Expand Down Expand Up @@ -30,12 +30,12 @@ const CopyButton: React.FunctionComponent = () => {

return (
<Button
color={Button.ButtonColor.white}
icon={'clipboard'}
key="copy"
onClick={() => handleCopy()}
size={Button.ButtonSize.small}
text="Copy Conversation History"
onClick={handleCopy}
text="Copy Chat"
iconLeft={{iconName: 'clipboard'}}
size="xs"
color="white"
type="secondary"
/>
);
};
Expand Down
4 changes: 4 additions & 0 deletions apps/src/aichat/views/aichatView.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,7 @@
flex: 1;
gap: 2px;
}

.clearButton {
margin-right: 5px;
}
14 changes: 13 additions & 1 deletion apps/src/aichat/views/model-customization-workspace.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,19 @@

textarea {
@extend %full-width;
height: 100px;
height: 120px;
min-height: 50px;
resize: vertical;
margin: 0;
border-radius: 4px;
border-color: $cyan;
}

input {
@extend %full-width;
height: 30px;
border-radius: 4px;
border-color: $lighter_gray;
Copy link
Contributor

Choose a reason for hiding this comment

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

Posted a question about this to @markabarrett on Slack.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Didn't fully implement the design system for inputs and textareas, but at least switched the outline to match the preferred color ($light_black)

}

.inputContainer {
Expand Down Expand Up @@ -55,8 +61,14 @@

.selectedModelDropdown {
@extend %full-width;
padding-bottom: 10px;
}

.updateButton {
width: 100%;
}

.compareModelsButton {
padding: 5px 16px;
margin: 10px 0;
}
1 change: 1 addition & 0 deletions apps/src/aichat/views/modelCustomization/PublishNotes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const PublishNotes: React.FunctionComponent = () => {
{property !== 'exampleTopics' && (
<InputTag
id={property}
type="text"
disabled={isDisabled(visibility)}
value={modelCardInfo[property]}
onChange={event =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,13 @@ const RetrievalCustomization: React.FunctionComponent = () => {
disabled={!newRetrievalContext || isDisabled(visibility)}
/>
</div>
<div className={styles.addedItemsHeaderContainer}>
<StrongText>Added</StrongText>
</div>
{retrievalContexts.map((message, index) => {
return (
<div key={index} className={styles.itemContainer}>
<span>{message}</span>
<button
type="button"
onClick={() => onRemove(index)}
Expand All @@ -95,7 +99,6 @@ const RetrievalCustomization: React.FunctionComponent = () => {
className={styles.removeItemIcon}
/>
</button>
<span className={styles.itemText}>{message}</span>
</div>
);
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ const SetupCustomization: React.FunctionComponent = () => {
text="Compare Models"
onClick={() => setIsShowingModelDialog(true)}
type="secondary"
className={styles.updateButton}
className={classNames(
styles.updateButton,
styles.compareModelsButton
)}
/>
{isShowingModelDialog && (
<CompareModelsDialog onClose={() => setIsShowingModelDialog(false)} />
Expand Down
2 changes: 1 addition & 1 deletion apps/src/aichat/views/modelCustomization/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
} from '../../types';

export const MIN_TEMPERATURE = 0;
export const MAX_TEMPERATURE = 2;
export const MAX_TEMPERATURE = 1;
export const SET_TEMPERATURE_STEP = 0.1;
export const MAX_RETRIEVAL_CONTEXTS = 20;
export const MAX_ASK_ABOUT_TOPICS = 10;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,22 @@

.itemContainer {
display: flex;
justify-content: space-between;
align-items: center;
margin: 5px;
padding: 4px 12px;
border-radius: 4px;
border-color: $light_gray_500;
border: 1px solid;
color: $light_gray_500;
}

.removeItemIcon {
color: $light_gray_500;
}

.itemText {
background-color: $light_gray_50;
flex: 1;
margin: 5px;
padding: 5px;
border-radius: 4px;
&:hover {
color: $light_negative_500;
}
}

.removeItemButton {
Expand All @@ -25,3 +29,9 @@
display: flex;
flex-direction: row-reverse;
}

.addedItemsHeaderContainer {
border-bottom: 1px solid $light_gray_200;
font-size: 14px;
margin: 16px 0 8px 0;
}