Skip to content

Commit 8f9bf74

Browse files
committed
Add method scope
1 parent 4de47d2 commit 8f9bf74

File tree

13 files changed

+146
-16
lines changed

13 files changed

+146
-16
lines changed

.github/copilot-instructions.md

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# Copilot Instructions
2+
3+
Digma UI is a React-based frontend for the Digma continuous feedback platform, designed to help developers analyze and improve code quality and runtime behavior. The project is a monorepo for multiple React applications and provides the distributions for different platforms: Web and IDEs (JetBrains, Visual Studio and VS Code)
4+
5+
Tech stack: TypeScript, React, React Router, Tanstack Table, React Hook Form, Recharts, styled-components, RTK Query, zustand (deprecated), axios, Storybook, Jest, Webpack, ESLint.
6+
7+
## Project Structure
8+
9+
- **.github/**
10+
GitHub-specific files such as workflows
11+
12+
- **scripts/**
13+
Utility scripts for development, build, and CI/CD automation.
14+
15+
- **.husky/**
16+
Git hooks managed by Husky for enforcing code quality and workflow automation.
17+
18+
- **.storybook/**
19+
Storybook configuration files for UI component development and documentation.
20+
21+
- **.vscode/**
22+
Visual Studio Code workspace settings and recommended extensions.
23+
24+
- **src/**
25+
Main source code for the Digma UI applications, including all React components, features, hooks, utilities, and configuration.
26+
27+
- **src/components/**
28+
Shared, reusable React components used across features and apps.
29+
30+
- **src/api/**
31+
Contains custom message API-related code, including service definitions, types, and API clients for communicating with backend services.
32+
33+
- **src/containers/**
34+
Entry points for React applications.
35+
36+
- **src/history/**
37+
Custom container for application history state management.
38+
39+
- **src/hooks/**
40+
Custom React hooks for shared logic across the applications.
41+
42+
- **src/logging/**
43+
Logger for application events and errors.
44+
45+
- **src/redux/**
46+
Redux store configuration, slices, and RTK Query services.
47+
48+
- **src/store/**
49+
Zustand stores and state management logic (deprecated).
50+
51+
- **src/stories/**
52+
Storybook stories for UI components.
53+
54+
- **src/typeGuards/**
55+
TypeScript type guard functions for runtime type checking.
56+
57+
- **src/utils/**
58+
General utility functions and helpers used throughout the project.
59+
60+
- **public/**
61+
Static assets served by the app (e.g., images, fonts).
62+
63+
- **apps.ts**
64+
Entry points and configuration for each distributive.
65+
66+
## Code Style
67+
68+
### JavaScript/TypeScript
69+
70+
- Use Boolean() constructor instead of !! operator for boolean casting.
71+
- Follow the ESLint rules from `eslint.config.mjs`.
72+
73+
### TypeScript
74+
75+
- Use `import type` for all type-only imports.
76+
- Define all type definitions and props in a `types.ts` file.
77+
78+
### React
79+
80+
- Each React component should reside in its own folder under the relevant feature/component directory.
81+
- The main component file must be named `[Component]/index.tsx`.
82+
- Do not import React at the top of files for JSX usage (React 18+).
83+
- Do not import the React namespace unless it is actually needed (e.g., for types or APIs not available via direct import).
84+
- Use implicit return for functional components when possible.
85+
- Destructure component props in the function signature.
86+
87+
### Styles
88+
89+
- Import styles as: `import * as s from "./styles"`.
90+
- Use a `styles.ts` file for styled-components definitions.
91+
- The top-level styled component should be named `Container`.
92+
- Do not use inline styles; use props with semantic names instead.
93+
- Do not use the `font-family` CSS rule for `SF Pro Text` (treat as the default OS font). Only specify `font-family` if a non-default font is required.
94+
- Use semantic color tokens from the theme (e.g., `theme.colors.v3.surface.primary`) instead of hardcoded color values or direct palette imports.
95+
- Use typography mixins from `typographies.ts` wherever Figma specifies a typography variable. Do not hardcode font-size, font-weight, or line-height if a corresponding typography token exists.
96+
- Avoid hardcoded colors, font sizes, and font weights if a semantic or design token exists.
97+
- All styled-components should use theme values via the `theme` prop for colors and typography, ensuring support for both dark and light themes.
98+
- Do not use inline types for styled-components. Always create and import interfaces for props used in styled-components from the component's `types.ts` file.
99+
- Do not use className prop without the need
100+
- Follow Stylelint rules for all CSS/styled-components code from `stylelint.config.js`.
101+
102+
### Images
103+
104+
- Use standard `<img>` tags for images, styled via styled-components if needed.
105+
106+
### Storybook & Tests
107+
108+
- Create a Storybook file named `[Component].stories.tsx` for stories.
109+
- Create a test file named `[Component].test.tsx` for tests.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
mode: "agent"
3+
tools: []
4+
---
5+
6+
Add the infrastructure for a new app called "<app-name>" for the "<platform>" platform.
7+
Take an existing app for the same platform as an example, but do not add any business logic yet—just the necessary boilerplate and wiring.
8+
Update all relevant files (such as apps.ts, containers, and routing) to register the new app and ensure it builds and runs like the other apps for this platform.

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Digma UI
22

3+
Digma UI is a React-based frontend for the Digma continuous feedback platform. The project is a monorepo for multiple React applications and provides the distributions for different platforms: Web and IDEs (JetBrains, Visual Studio and VS Code)
4+
35
Install dependencies:
46

57
```shell
@@ -57,7 +59,7 @@ To set environment variables use .env file
5759

5860
## Jaeger UI
5961

60-
The Digma UI distributive includes a [Digma fork of Jaeger UI](https://github.com/digma-ai/jaeger-ui). You can find the linked version in the [./dependencies.json](./dependencies.json) file.
62+
The Digma UI distribution includes a [Digma fork of Jaeger UI](https://github.com/digma-ai/jaeger-ui). You can find the linked version in the [./dependencies.json](./dependencies.json) file.
6163

6264
To use a custom build of Jaeger UI during development set `JAEGER_UI_PATH` environment variable.
6365

scripts/get-jaeger-ui.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,13 @@ if (process.env.JAEGER_UI_PATH) {
9191
if (!fs.existsSync(customJaegerUIPath)) {
9292
// eslint-disable-next-line no-console
9393
console.error(
94-
`Jaeger UI distributive has not been found at ${customJaegerUIPath}`
94+
`Jaeger UI distribution has not been found at ${customJaegerUIPath}`
9595
);
9696
process.exit(1);
9797
}
9898

9999
// eslint-disable-next-line no-console
100-
console.log(`Using Jaeger UI distributive from ${customJaegerUIPath}`);
100+
console.log(`Using Jaeger UI distribution from ${customJaegerUIPath}`);
101101

102102
fs.copySync(customJaegerUIPath, extractPath);
103103

src/api/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ export const initializeDigmaMessageListener = (
6565
break;
6666
}
6767

68-
window.addEventListener("message", handleDigmaMessage);
69-
7068
return () => {
7169
switch (platform) {
7270
case "Visual Studio":

src/components/Admin/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const Admin = () => {
3232
FeatureFlag.IsUserIdEnabled
3333
);
3434

35-
// Clear issues report state when user changes
35+
// Clear state when user changes
3636
useEffect(() => {
3737
if (isUserIdEnabled && userProfile) {
3838
if (currentUser?.uid !== userProfile?.uid) {

src/components/Main/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const getURLToNavigateOnCodeLensClick = (scope: Scope): string | undefined => {
4141
}
4242

4343
const codeLens = scope.context.payload.codeLens;
44-
if (!codeLens.scopeCodeObjectId.startsWith("span:")) {
44+
if (!codeLens.scopeCodeObjectId?.startsWith("span:")) {
4545
return;
4646
}
4747

src/components/common/App/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,9 @@ export const App = ({ theme, children, id }: AppProps) => {
332332
};
333333
scope = newScope;
334334

335-
setGlobalErrorsSearch(newScope.context.payload.codeLens.codeMethod);
335+
if (newScope.method?.methodId) {
336+
setGlobalErrorsSearch(newScope.method?.methodId);
337+
}
336338
}
337339

338340
setScope(scope);

src/components/common/App/types.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,14 @@ export interface ScopeSpan {
5757
role: ScopeSpanRole | null;
5858
}
5959

60+
export interface MethodScope {
61+
methodId: string;
62+
displayName: string | null;
63+
}
64+
6065
export interface Scope {
6166
span: ScopeSpan | null;
67+
method?: MethodScope;
6268
code: {
6369
relatedCodeDetailsList: CodeDetails[];
6470
codeDetailsList: CodeDetails[];
@@ -77,7 +83,7 @@ export interface Scope {
7783
export interface CodeLens {
7884
id: string;
7985
codeMethod: string;
80-
scopeCodeObjectId: string;
86+
scopeCodeObjectId?: string;
8187
lensTitle: string;
8288
importance: number;
8389
}

src/components/common/IssuesReport/Header/styles.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export const Filters = styled(Row)`
5454

5555
const StyledToggle = styled(Toggle)`
5656
align-items: center;
57-
background-color: transparent;
57+
background: transparent;
5858
border-radius: 8px;
5959
border-color: ${({ theme }) => theme.colors.v3.stroke.primaryLight};
6060
`;

0 commit comments

Comments
 (0)