Skip to content
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
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 2

[*.go]
indent_size = 4
10 changes: 10 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
* text=auto eol=lf
*.go text eol=lf
*.js text eol=lf
*.ts text eol=lf
*.tsx text eol=lf
*.json text eol=lf
*.yml text eol=lf
*.yaml text eol=lf
*.sh text eol=lf
*.bat text eol=crlf
5 changes: 5 additions & 0 deletions ui/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"semi": true,
"singleQuote": true,
"printWidth": 100
}
Comment thread
martian56 marked this conversation as resolved.
18 changes: 9 additions & 9 deletions ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ If you are developing a production application, we recommend updating the config

```js
export default defineConfig([
globalIgnores(["dist"]),
globalIgnores(['dist']),
{
files: ["**/*.{ts,tsx}"],
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...

Expand All @@ -34,7 +34,7 @@ export default defineConfig([
],
languageOptions: {
parserOptions: {
project: ["./tsconfig.node.json", "./tsconfig.app.json"],
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
Expand All @@ -47,23 +47,23 @@ You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-re

```js
// eslint.config.js
import reactX from "eslint-plugin-react-x";
import reactDom from "eslint-plugin-react-dom";
import reactX from 'eslint-plugin-react-x';
import reactDom from 'eslint-plugin-react-dom';

export default defineConfig([
globalIgnores(["dist"]),
globalIgnores(['dist']),
{
files: ["**/*.{ts,tsx}"],
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Enable lint rules for React
reactX.configs["recommended-typescript"],
reactX.configs['recommended-typescript'],
// Enable lint rules for React DOM
reactDom.configs.recommended,
],
languageOptions: {
parserOptions: {
project: ["./tsconfig.node.json", "./tsconfig.app.json"],
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
Expand Down
16 changes: 8 additions & 8 deletions ui/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import js from "@eslint/js";
import globals from "globals";
import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";
import tseslint from "typescript-eslint";
import { defineConfig, globalIgnores } from "eslint/config";
import js from '@eslint/js';
import globals from 'globals';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';
import tseslint from 'typescript-eslint';
import { defineConfig, globalIgnores } from 'eslint/config';

export default defineConfig([
globalIgnores(["dist"]),
globalIgnores(['dist']),
{
files: ["**/*.{ts,tsx}"],
files: ['**/*.{ts,tsx}'],
extends: [
js.configs.recommended,
tseslint.configs.recommended,
Expand Down
4 changes: 2 additions & 2 deletions ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Devlane UI",
"private": true,
"version": "0.4.0",
"version": "0.4.1",
Comment thread
martian56 marked this conversation as resolved.
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
10 changes: 5 additions & 5 deletions ui/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { RouterProvider } from "react-router-dom";
import { AuthProvider } from "./contexts/AuthContext";
import { FavoritesProvider } from "./contexts/FavoritesContext";
import { ThemeProvider } from "./contexts/ThemeContext";
import { router } from "./routes";
import { RouterProvider } from 'react-router-dom';
import { AuthProvider } from './contexts/AuthContext';
import { FavoritesProvider } from './contexts/FavoritesContext';
import { ThemeProvider } from './contexts/ThemeContext';
import { router } from './routes';

export default function App() {
return (
Expand Down
10 changes: 5 additions & 5 deletions ui/src/api/client.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import axios, { type AxiosError } from "axios";
import { config } from "../config/env";
import axios, { type AxiosError } from 'axios';
import { config } from '../config/env';

/**
* Shared Axios instance for all API requests.
Expand All @@ -11,7 +11,7 @@ export const apiClient = axios.create({
baseURL: config.apiBaseUrl,
withCredentials: true,
headers: {
"Content-Type": "application/json",
'Content-Type': 'application/json',
},
});

Expand All @@ -21,7 +21,7 @@ export const apiClient = axios.create({
apiClient.interceptors.request.use((config) => {
if (config.data instanceof FormData && config.headers) {
const h = config.headers as Record<string, unknown>;
delete h["Content-Type"];
delete h['Content-Type'];
}
return config;
});
Expand All @@ -46,7 +46,7 @@ export function getApiErrorMessage(err: unknown): string {
if (ax.response?.status) return `Request failed (${ax.response.status}).`;
}
if (err instanceof Error) return err.message;
return "An unexpected error occurred.";
return 'An unexpected error occurred.';
}

apiClient.interceptors.response.use(
Expand Down
6 changes: 3 additions & 3 deletions ui/src/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export { apiClient, getApiErrorMessage } from "./client";
export type { ApiErrorResponse } from "./client";
export type { CreateWorkspaceRequest, WorkspaceApiResponse } from "./types";
export { apiClient, getApiErrorMessage } from './client';
export type { ApiErrorResponse } from './client';
export type { CreateWorkspaceRequest, WorkspaceApiResponse } from './types';
2 changes: 1 addition & 1 deletion ui/src/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ export interface IssueViewApiResponse {
filters?: Record<string, unknown>;
display_filters?: Record<string, unknown>;
display_properties?: Record<string, unknown>;
access?: number | "public" | "private";
access?: number | 'public' | 'private';
Comment thread
martian56 marked this conversation as resolved.
sort_order?: number;
anchor?: string | null;
is_favorite?: boolean;
Expand Down
65 changes: 22 additions & 43 deletions ui/src/components/AddExistingWorkItemModal.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useEffect, useState, useMemo } from "react";
import { createPortal } from "react-dom";
import { Button } from "./ui";
import { issueService } from "../services/issueService";
import { moduleService } from "../services/moduleService";
import type { IssueApiResponse } from "../api/types";
import { useEffect, useState, useMemo } from 'react';
import { createPortal } from 'react-dom';
import { Button } from './ui';
import { issueService } from '../services/issueService';
import { moduleService } from '../services/moduleService';
import type { IssueApiResponse } from '../api/types';

const IconSearch = () => (
<svg
Expand Down Expand Up @@ -43,7 +43,7 @@ export function AddExistingWorkItemModal({
projectIdentifier,
onAdded,
}: AddExistingWorkItemModalProps) {
const [searchQuery, setSearchQuery] = useState("");
const [searchQuery, setSearchQuery] = useState('');
const [selectedIds, setSelectedIds] = useState<Set<string>>(new Set());
const [projectIssues, setProjectIssues] = useState<IssueApiResponse[]>([]);
const [moduleIssueIds, setModuleIssueIds] = useState<Set<string>>(new Set());
Expand All @@ -67,7 +67,7 @@ export function AddExistingWorkItemModal({
setSelectedIds(new Set());
})
.catch(() => {
if (!cancelled) setError("Failed to load work items");
if (!cancelled) setError('Failed to load work items');
})
.finally(() => {
if (!cancelled) setLoading(false);
Expand All @@ -79,7 +79,7 @@ export function AddExistingWorkItemModal({

useEffect(() => {
if (!open) {
setSearchQuery("");
setSearchQuery('');
setSelectedIds(new Set());
}
}, [open]);
Expand All @@ -93,7 +93,7 @@ export function AddExistingWorkItemModal({
const q = searchQuery.trim().toLowerCase();
return availableIssues.filter((issue) => {
const id = displayId(issue, projectIdentifier);
const name = (issue.name ?? "").toLowerCase();
const name = (issue.name ?? '').toLowerCase();
return id.toLowerCase().includes(q) || name.includes(q);
});
}, [availableIssues, searchQuery, projectIdentifier]);
Expand Down Expand Up @@ -127,20 +127,13 @@ export function AddExistingWorkItemModal({
await Promise.all(
ids
.slice(i, i + BATCH)
.map((issueId) =>
moduleService.addIssue(
workspaceSlug,
projectId,
moduleId,
issueId,
),
),
.map((issueId) => moduleService.addIssue(workspaceSlug, projectId, moduleId, issueId)),
);
}
onAdded?.();
onClose();
} catch {
setError("Failed to add work items");
setError('Failed to add work items');
} finally {
setSubmitting(false);
}
Expand All @@ -149,8 +142,8 @@ export function AddExistingWorkItemModal({
const selectedCount = selectedIds.size;
const selectionLabel =
selectedCount === 0
? "No work items selected"
: `${selectedCount} work item${selectedCount === 1 ? "" : "s"} selected`;
? 'No work items selected'
: `${selectedCount} work item${selectedCount === 1 ? '' : 's'} selected`;

const footer = (
<div className="flex w-full items-center justify-between">
Expand Down Expand Up @@ -185,11 +178,7 @@ export function AddExistingWorkItemModal({
aria-modal="true"
aria-labelledby="add-existing-work-item-title"
>
<div
className="absolute inset-0 bg-(--bg-backdrop)"
onClick={onClose}
aria-hidden
/>
<div className="absolute inset-0 bg-(--bg-backdrop)" onClick={onClose} aria-hidden />
<div
className="relative z-10 flex w-full max-w-md flex-col rounded-lg border border-(--border-subtle) bg-(--bg-surface-1) shadow-(--shadow-overlay)"
onClick={(e) => e.stopPropagation()}
Expand Down Expand Up @@ -217,18 +206,14 @@ export function AddExistingWorkItemModal({
</div>

<div className="flex min-h-0 flex-1 flex-col overflow-hidden px-5 py-4">
{error && (
<p className="mb-2 text-sm text-(--txt-danger-primary)">{error}</p>
)}
{error && <p className="mb-2 text-sm text-(--txt-danger-primary)">{error}</p>}
{loading ? (
<p className="py-8 text-center text-sm text-(--txt-tertiary)">
Loading work items…
</p>
<p className="py-8 text-center text-sm text-(--txt-tertiary)">Loading work items…</p>
) : filteredIssues.length === 0 ? (
<p className="py-8 text-center text-sm text-(--txt-tertiary)">
{availableIssues.length === 0
? "No other work items in this project."
: "No matching work items."}
? 'No other work items in this project.'
: 'No matching work items.'}
</p>
) : (
<ul className="max-h-64 overflow-y-auto divide-y divide-(--border-subtle)">
Expand All @@ -249,12 +234,8 @@ export function AddExistingWorkItemModal({
aria-hidden
/>
<span className="min-w-0 flex-1 truncate text-sm">
<span className="font-medium text-(--txt-primary)">
{id}
</span>
<span className="ml-2 text-(--txt-secondary)">
{issue.name || "—"}
</span>
<span className="font-medium text-(--txt-primary)">{id}</span>
<span className="ml-2 text-(--txt-secondary)">{issue.name || '—'}</span>
</span>
</label>
</li>
Expand All @@ -264,9 +245,7 @@ export function AddExistingWorkItemModal({
)}
</div>

<div className="flex w-full border-t border-(--border-subtle) px-5 py-4">
{footer}
</div>
<div className="flex w-full border-t border-(--border-subtle) px-5 py-4">{footer}</div>
</div>
</div>,
document.body,
Expand Down
Loading
Loading