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

Lint creation flow improvements #105

Merged
merged 2 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion apps/color-buddy/src/linting/LintCustomizationTab.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@
on:click={() => {
lintStore.deleteLint(lint.id);
lintStore.setFocusedLint(false);
showDeleteDoubleCheck = false;
}}
class={buttonStyle}
>
Expand Down Expand Up @@ -195,7 +196,13 @@
>
Clone this lint
</button>
<a class={buttonStyle} target="_blank" href="./lang-docs.md">Docs</a>
<a
class={buttonStyle}
target="_blank"
href="https://color-buddy-docs.netlify.app/lang-docs.html"
>
Docs
</a>
</div>
</div>

Expand Down
19 changes: 16 additions & 3 deletions apps/color-buddy/src/linting/NewLintSuggestion.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@
import { loadLints } from "../lib/api-calls";
let lintPrompt: string = "";
let requestState: "idle" | "loading" | "loaded" | "failed" = "idle";

function getNewName(): string {
const lintNames = new Set($lintStore.lints.map((x) => x.name));
let name = "New Lint";
let i = 2;
while (lintNames.has(name)) {
name = `New Lint ${i}`;
i++;
}
return name;
}
function makeRequest() {
requestState = "loading";

Expand All @@ -29,7 +40,7 @@
const program = JSONStringify(JSON.stringify(prog));
let description = explanation || lintPrompt;
let failMessage = lintPrompt;
let name = "New Lint";
let name = lintPrompt;

lintStore.createNewLint({
name,
Expand All @@ -40,6 +51,7 @@
setTimeout(() => {
loadLints();
lintPrompt = "";
configStore.setEvalDisplayMode("lint-customization");
}, 100);

requestState = "loaded";
Expand Down Expand Up @@ -78,8 +90,9 @@
<button
class={buttonStyle}
on:click|stopPropagation|preventDefault={() => {
let name = getNewName();
lintStore.createNewLint({
name: "New Lint",
name,
description: "",
failMessage: "",
program: "true",
Expand All @@ -100,6 +113,6 @@
toggle();
}}
>
New Lint
Create New Lint
</button>
</Tooltip>
4 changes: 2 additions & 2 deletions apps/docs/docs/buglist.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
- [x] These palettes are labeled Use and Reject. I think it would be useful if they included what algorithm was used. For example, Use(ColorBuddy), Reject(LLM)
- [x] In Gamut should be a Usability Check, not a Design Check.
- [x] Settings raises a long list of lints, which really needs a scroll bar or some other way of managing the list on a smaller screen. Also, it would be more conventional to make this a list of Selected lints rather than a List of Ignored lints.
- [ ] the New lint text box doesn't seem to do anything. I tried several types of requests, got nothing back.
- [x] the New lint text box doesn't seem to do anything. I tried several types of requests, got nothing back.
- [ ] Being able to copy and modify an existing lint seems very powerful, but I see no way to do that. AM: click lint info / click customize / click clone
- [ ] I would like a way to test all colors for text legibility, no matter what their tags are. Maybe this is just a new lint?
- [x] I would like a way to test all colors for text legibility, no matter what their tags are. Maybe this is just a new lint?
- [ ] I would like to improve the appearance of the red X's on the colors. Ideally, we'd have some tasteful icons, one per major category (Usability, Accessibility, Design, Custom) that were legible on all colors.
- [ ] I'd like to see more metrics in the lint descriptions and errors. For example, what contrast do we need for text legibility, and what is the contrast for those colors that failed?

Expand Down
Loading