Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add preset selector in TasksPage#19012

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
johnstcn merged 17 commits intomainfromcj/tasks-preset-selector
Jul 24, 2025
Merged

Conversation

johnstcn
Copy link
Member

@johnstcnjohnstcn commentedJul 23, 2025
edited
Loading

  • Adds a preset selector in TasksPagethat is visible if the selected template version defines presets, with the default preset pre-selected and at the top of the list.
  • If no default preset exists, the user is prompted to select one.
  • If a preset defines an AI Prompt, it will override the textarea.

@johnstcnjohnstcn self-assigned thisJul 23, 2025
@johnstcnjohnstcnforce-pushed thecj/tasks-preset-selector branch from0a11e8e toebeb601CompareJuly 24, 2025 11:32
@johnstcnjohnstcn marked this pull request as ready for reviewJuly 24, 2025 11:44
@johnstcnjohnstcn requested a review fromCopilotJuly 24, 2025 11:45
Copy link
Contributor

@CopilotCopilotAI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a preset selector to the TasksPage that appears when the selected template version has defined presets. If a preset contains an AI Prompt parameter, it overrides the textarea input and makes it read-only.

  • Adds preset selection functionality with automatic default preset selection
  • Implements AI prompt override behavior when presets contain AI Prompt parameters
  • Refactors test data by moving mock objects to shared test helpers for better reusability

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

FileDescription
site/src/testHelpers/entities.tsAdds mock preset data and task data for testing preset functionality
site/src/pages/TasksPage/TasksPage.tsxImplements preset selector UI, preset fetching logic, and AI prompt override behavior
site/src/pages/TasksPage/TasksPage.stories.tsxUpdates stories to use shared mock data and adds new stories for preset scenarios

>
<SelectTrigger
id="templateID"
className="w-80 text-xs [&_svg]:size-icon-xs border-0 bg-surface-secondary h-8 px-3"

Choose a reason for hiding this comment

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

The template and preset selectors use identical styling (w-80 text-xs [&_svg]:size-icon-xs border-0 bg-surface-secondary h-8 px-3). Consider extracting this into a CSS class or constant to avoid duplication.

Suggested change
className="w-80 text-xs [&_svg]:size-icon-xs border-0 bg-surface-secondary h-8 px-3"
className="select-trigger-style"

Copilot uses AI. Check for mistakes.

Comment on lines -312 to -342
constMockTasks=[
{
workspace:{
...MockWorkspace,
latest_app_status:MockWorkspaceAppStatus,
},
prompt:"Create competitors page",
},
{
workspace:{
...MockWorkspace,
id:"workspace-2",
latest_app_status:{
...MockWorkspaceAppStatus,
message:"Avatar size fixed!",
},
},
prompt:"Fix user avatar size",
},
{
workspace:{
...MockWorkspace,
id:"workspace-3",
latest_app_status:{
...MockWorkspaceAppStatus,
message:"Accessibility issues fixed!",
},
},
prompt:"Fix accessibility issues",
},
];
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

review: moved toentities.ts

jaaydenh reacted with thumbs up emoji
@johnstcnjohnstcn requested a review frommtojekJuly 24, 2025 11:58
Copy link
Member

@mtojekmtojek left a comment

Choose a reason for hiding this comment

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

I don't feel super comfortable with extrauseEffects, but I assume that we need to reload it dynamically, right?

</SelectTrigger>
<SelectContent>
{presets
.sort((a,b)=>{
Copy link
Member

Choose a reason for hiding this comment

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

nit: maybe extract to a seperate function with a comment?

johnstcn reacted with thumbs up emoji
// Extract AI prompt from selected preset
constselectedPreset=presets?.find((p)=>p.ID===selectedPresetId);
constpresetAIPrompt=selectedPreset?.Parameters.find(
(param)=>param.Name===AI_PROMPT_PARAMETER_NAME,
Copy link
Member

Choose a reason for hiding this comment

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

nit: is it special/magic parameter now?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

always has been

@jaaydenh
Copy link
Contributor

Is selecting a preset required? On the create workspace page I added a "None" to make it explicit that choosing a preset is not necessary.

@johnstcn
Copy link
MemberAuthor

Is selecting a preset required? On the create workspace page I added a "None" to make it explicit that choosing a preset is not necessary.

Right now it technically isn't, although presets are currently the only way to expose parameter values on Tasks page. I can add a "none" option for consistency.

placeholder={textareaPlaceholder}
className={`border-0 resize-none w-full h-full bg-transparent rounded-lg outline-none flex min-h-[60px]
text-sm shadow-sm text-content-primary placeholder:text-content-secondary md:text-sm`}
text-sm shadow-sm text-content-primary placeholder:text-content-secondary md:text-sm${
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this could be done later but it can be confusing for users that the Prompt is disabled because of a preset. In the dynamic parameters create workspace page, I label parameters when they are preset as such so user know why they can't be edited.

johnstcn reacted with thumbs up emoji
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I could add a quick tooltip here

Copy link
MemberAuthor

@johnstcnjohnstcnJul 24, 2025
edited
Loading

Choose a reason for hiding this comment

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

Addressed in0fd55e2

@johnstcnjohnstcnforce-pushed thecj/tasks-preset-selector branch fromf6ecc40 tob3916e2CompareJuly 24, 2025 17:20
Copy link
Contributor

@jaaydenhjaaydenh left a comment

Choose a reason for hiding this comment

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

LGTM

@johnstcnjohnstcn merged commit9a05a8a intomainJul 24, 2025
26 of 27 checks passed
@johnstcnjohnstcn deleted the cj/tasks-preset-selector branchJuly 24, 2025 19:19
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsJul 24, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

Copilot code reviewCopilotCopilot left review comments

@jaaydenhjaaydenhjaaydenh approved these changes

@mtojekmtojekmtojek approved these changes

Assignees

@johnstcnjohnstcn

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@johnstcn@jaaydenh@mtojek

[8]ページ先頭

©2009-2025 Movatter.jp