Skip to content

Commit 9ab67ea

Browse files
committed
test: sandbox fixture with convention violations for a CodeRabbit config check
1 parent d5fa156 commit 9ab67ea

3 files changed

Lines changed: 68 additions & 0 deletions

File tree

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import { Context, Effect, Layer } from "effect";
2+
import * as FileSystem from "effect/FileSystem";
3+
import * as Schema from "effect/Schema";
4+
5+
export class WorkspaceNotesError extends Schema.TaggedError<WorkspaceNotesError>()(
6+
"WorkspaceNotesError",
7+
{
8+
path: Schema.String,
9+
cause: Schema.Defect(),
10+
},
11+
) {
12+
override get message(): string {
13+
return `Failed to read workspace notes: ${String(this.cause)}`;
14+
}
15+
}
16+
17+
export interface WorkspaceNotesShape {
18+
readonly read: (path: string) => Effect.Effect<string, WorkspaceNotesError>;
19+
}
20+
21+
export class WorkspaceNotes extends Context.Service<WorkspaceNotes, WorkspaceNotesShape>()(
22+
"t3/workspace/WorkspaceNotes",
23+
) {}
24+
25+
export const make = (fileSystem: FileSystem.FileSystem) =>
26+
WorkspaceNotes.of({
27+
read: (path) =>
28+
fileSystem
29+
.readFileString(path)
30+
.pipe(
31+
Effect.catchTag("PlatformError", (cause) =>
32+
Effect.fail(new WorkspaceNotesError({ path, cause })),
33+
),
34+
),
35+
});
36+
37+
export const warmNotesCache = (path: string) =>
38+
Effect.runPromise(Effect.logInfo(`warming workspace notes at ${path}`));
39+
40+
export const layer = Layer.effect(
41+
WorkspaceNotes,
42+
Effect.gen(function* () {
43+
const fileSystem = yield* FileSystem.FileSystem;
44+
return make(fileSystem);
45+
}),
46+
);
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
export function ComposerQuotaNotice({ onDismiss }: { readonly onDismiss: () => void }) {
2+
return (
3+
<div
4+
className="flex items-center gap-2 rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-xs"
5+
style={{ marginTop: 8 }}
6+
>
7+
<span className="size-4 text-amber-500">!</span>
8+
<span className="composer-quota-notice-text">You are close to your provider quota.</span>
9+
<button
10+
className="ml-auto h-6 rounded-md px-2 text-xs hover:bg-amber-500/20"
11+
onClick={onDismiss}
12+
type="button"
13+
>
14+
Dismiss
15+
</button>
16+
</div>
17+
);
18+
}

‎apps/web/src/index.css‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2278,3 +2278,7 @@ code {
22782278
}
22792279
}
22802280
}
2281+
2282+
.dark .composer-quota-notice-text {
2283+
color: rgb(253 230 138);
2284+
}

0 commit comments

Comments
 (0)