Skip to content

Commit 67550fe

Browse files
committed
next/store/course license: set academic user value properly, adjust presets, add idle timeout help and hide period selection in form
1 parent 6f1a555 commit 67550fe

File tree

6 files changed

+157
-73
lines changed

6 files changed

+157
-73
lines changed

src/.claude/settings.local.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"Bash(pnpm tsc:*)",
55
"Bash(pnpm build:*)",
66
"Bash(git add:*)",
7-
"Bash(git commit:*)"
7+
"Bash(git commit:*)",
8+
"Bash(prettier -w:*)"
89
],
910
"deny": []
1011
}

src/CLAUDE.md

Lines changed: 42 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
44

55
# CoCalc Source Repository
66

7-
* This is the source code of CoCalc in a Git repository
8-
* It is a complex JavaScript/TypeScript SaaS application
9-
* CoCalc is organized as a monorepository (multi-packages) in the subdirectory "./packages"
10-
* The packages are managed as a pnpm workspace in "./packages/pnpm-workspace.yaml"
7+
- This is the source code of CoCalc in a Git repository
8+
- It is a complex JavaScript/TypeScript SaaS application
9+
- CoCalc is organized as a monorepository (multi-packages) in the subdirectory "./packages"
10+
- The packages are managed as a pnpm workspace in "./packages/pnpm-workspace.yaml"
1111

1212
## Code Style
1313

1414
- Everything is written in TypeScript code
1515
- Indentation: 2-spaces
16+
- Run `pretter -w [filename]` after modifying a file (ts, tsx, md, json, ...) to format it correctly.
1617
- All .js and .ts files are formatted by the tool prettier
1718
- Add suitable types when you write code
1819
- Variable name styles are "camelCase" for local and "FOO_BAR" for global variables. If you edit older code not following these guidlines, adjust this rule to fit the files style.
@@ -23,28 +24,32 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
2324
## Development Commands
2425

2526
### Essential Commands
27+
2628
- `pnpm build-dev` - Build all packages for development
2729
- `pnpm clean` - Clean all node_modules and dist directories
28-
- `pnpm database` - Start PostgreSQL database server
29-
- `pnpm hub` - Start the main hub server
30-
- `pnpm psql` - Connect to the PostgreSQL database
3130
- `pnpm test` - Run full test suite
32-
- `pnpm test-parallel` - Run tests in parallel across packages
3331
- `pnpm depcheck` - Check for dependency issues
32+
- `prettier -w [filename]` to format the style of a file after editing it
33+
- after creating a file, run `git add [filename]` to start tracking it
3434

3535
### Package-Specific Commands
36-
- `cd packages/[package] && pnpm tsc` - Watch TypeScript compilation for a specific package
36+
37+
- `cd packages/[package] && pnpm build` - Build and compile a specific package
38+
- for packages/next and packages/static, run `cd packages/[package] && pnpm build-dev`
39+
- `cd packages/[package] && pnpm tsc:watch` - TypeScript compilation in watch mode for a specific package
3740
- `cd packages/[package] && pnpm test` - Run tests for a specific package
3841
- `cd packages/[package] && pnpm build` - Build a specific package
42+
- **IMPORTANT**: When modifying packages like `util` that other packages depend on, you must run `pnpm build` in the modified package before typechecking dependent packages
3943

40-
### Development Setup
41-
1. Start database: `pnpm database`
42-
2. Start hub: `pnpm hub`
43-
3. For TypeScript changes, run `pnpm tsc` in the relevant package directory
44+
### Development
45+
46+
- After code changes, run `pretter -w [filename]` to ensure consistent styling
47+
- After TypeScript or `*.tsx` changes, run `pnpm build` in the relevant package directory
4448

4549
## Architecture Overview
4650

4751
### Package Structure
52+
4853
CoCalc is organized as a monorepo with key packages:
4954

5055
- **frontend** - React/TypeScript frontend application using Redux-style stores and actions
@@ -62,25 +67,29 @@ CoCalc is organized as a monorepo with key packages:
6267
### Key Architectural Patterns
6368

6469
#### Frontend Architecture
70+
6571
- **Redux-style State Management**: Uses custom stores and actions pattern (see `packages/frontend/app-framework/actions-and-stores.ts`)
6672
- **TypeScript React Components**: All frontend code is TypeScript with proper typing
6773
- **Modular Store System**: Each feature has its own store/actions (AccountStore, BillingStore, etc.)
6874
- **WebSocket Communication**: Real-time communication with backend via WebSocket messages
6975

7076
#### Backend Architecture
77+
7178
- **PostgreSQL Database**: Primary data store with sophisticated querying system
7279
- **WebSocket Messaging**: Real-time communication between frontend and backend
7380
- **Conat System**: Container orchestration for compute servers
7481
- **Event-Driven Architecture**: Extensive use of EventEmitter patterns
7582
- **Microservice-like Packages**: Each package handles specific functionality
7683

7784
#### Communication Patterns
85+
7886
- **WebSocket Messages**: Primary communication method (see `packages/comm/websocket/types.ts`)
7987
- **Database Queries**: Structured query system with typed interfaces
8088
- **Event Emitters**: Inter-service communication within backend
8189
- **REST-like APIs**: Some HTTP endpoints for specific operations
8290

8391
### Key Technologies
92+
8493
- **TypeScript**: Primary language for all new code
8594
- **React**: Frontend framework
8695
- **PostgreSQL**: Database
@@ -91,40 +100,56 @@ CoCalc is organized as a monorepo with key packages:
91100
- **SASS**: CSS preprocessing
92101

93102
### Database Schema
103+
94104
- Comprehensive schema in `packages/util/db-schema`
95105
- Query abstractions in `packages/database/postgres/`
96106
- Type-safe database operations with TypeScript interfaces
97107

98108
### Testing
109+
99110
- **Jest**: Primary testing framework
100111
- **ts-jest**: TypeScript support for Jest
101112
- **jsdom**: Browser environment simulation for frontend tests
102113
- Test files use `.test.ts` or `.spec.ts` extensions
103114
- Each package has its own jest.config.js
104115

105116
### Import Patterns
117+
106118
- Use absolute imports with `@cocalc/` prefix for cross-package imports
107119
- Example: `import { cmp } from "@cocalc/util/misc"`
108120
- Type imports: `import type { Foo } from "./bar"`
109121
- Destructure imports when possible
110122

111123
### Development Workflow
112-
1. Changes to TypeScript require compilation (`pnpm tsc` in relevant package)
124+
125+
1. Changes to TypeScript require compilation (`pnpm build` in relevant package)
113126
2. Database must be running before starting hub
114127
3. Hub coordinates all services and should be restarted after changes
115128
4. Use `pnpm clean && pnpm build-dev` when switching branches or after major changes
116129

117130
# Workflow
118-
- Be sure to typecheck when you're done making a series of code changes
131+
132+
- Be sure to build when you're done making a series of code changes
119133
- Prefer running single tests, and not the whole test suite, for performance
120134

121135
## Git Workflow
122136

137+
- Never modify a file when in the `master` or `main` branch
138+
- All changes happen through feature branches, which are pushed as pull requests to GitHub
139+
- When creating a new file, run `git add [filename]` to track the file.
123140
- Prefix git commits with the package and general area. e.g. 'frontend/latex: ...' if it concerns latex editor changes in the packages/frontend/... code.
124141
- When pushing a new branch to Github, track it upstream. e.g. `git push --set-upstream origin feature-foo` for branch "feature-foo".
125142

126-
# important-instruction-reminders
143+
# Important Instruction Reminders
144+
127145
- Do what has been asked; nothing more, nothing less.
128146
- NEVER create files unless they're absolutely necessary for achieving your goal.
129147
- ALWAYS prefer editing an existing file to creating a new one.
130-
- NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested by the User.
148+
- REFUSE to modify files when the git repository is on the `master` or `main` branch.
149+
- NEVER proactively create documentation files (`*.md`) or README files. Only create documentation files if explicitly requested by the User.
150+
151+
# Ignore
152+
153+
- Ignore files covered by `.gitignore`
154+
- Ignore everything in `node_modules` or `dist` directories
155+
- Ignore all files not tracked by Git, unless they are newly created files

src/packages/frontend/components/help-icon.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ Display a ? "help" icon, which -- when clicked -- shows a help tip
99

1010
import { Button, Popover } from "antd";
1111
import type { TooltipPlacement } from "antd/es/tooltip";
12-
import { CSSProperties } from "react";
12+
import { CSSProperties, useState } from "react";
1313

14-
import { CSS, React, useState } from "@cocalc/frontend/app-framework";
14+
// ATTN: do not import @cocalc/app-framework or components, because this is also used in next!
1515
import { COLORS } from "@cocalc/util/theme";
1616
import { Icon } from "./icon";
1717

@@ -34,7 +34,7 @@ export const HelpIcon: React.FC<Props> = ({
3434
}: Props) => {
3535
const [open, setOpen] = useState<boolean>(false);
3636

37-
const textStyle: CSS = {
37+
const textStyle: CSSProperties = {
3838
color: COLORS.BS_BLUE_TEXT,
3939
cursor: "pointer",
4040
...style,
@@ -68,8 +68,8 @@ export const HelpIcon: React.FC<Props> = ({
6868
onOpenChange={setOpen}
6969
>
7070
<span style={textStyle}>
71+
{extra ? <>{extra} </> : undefined}
7172
<Icon style={textStyle} name="question-circle" />
72-
{extra ? <> {extra}</> : undefined}
7373
</span>
7474
</Popover>
7575
);

src/packages/next/components/store/quota-config-presets.tsx

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ export const COURSE = {
208208
"Edit LaTeX, Markdown, R Documents, and use VS Code,",
209209
`${STANDARD_DISK} GB disk space is sufficient to store many files and small datasets.`,
210210
],
211-
note: <Paragraph type="secondary">TODO NOTE</Paragraph>,
211+
note: <>Suitable for most courses.</>,
212212
details: (
213213
<>
214214
You can run a couple of Jupyter Notebooks in a project at once,
@@ -224,4 +224,30 @@ export const COURSE = {
224224
uptime: "short",
225225
member: true,
226226
},
227-
} as const satisfies { [key in "standard"]: PresetConfig };
227+
advanced: {
228+
icon: "rocket",
229+
name: "Advanced",
230+
descr: "provides higher quotas for more intensive course work",
231+
expect: [
232+
"Run more Jupyter Notebooks simultaneously,",
233+
"Handle memory-intensive computations,",
234+
"Longer idle timeout for extended work sessions,",
235+
"Sufficient resources for advanced coursework.",
236+
],
237+
note: <>For intense computations requiring more resources.</>,
238+
details: (
239+
<>
240+
This configuration provides enhanced resources for more demanding
241+
coursework. With 1 CPU, 8GB RAM, and a 2-hour idle timeout, students can
242+
work on memory-intensive projects and longer computational tasks without
243+
interruption. Ideal for advanced programming, data science, and
244+
research-oriented courses.
245+
</>
246+
),
247+
cpu: 1,
248+
ram: 8,
249+
disk: 2 * STANDARD_DISK,
250+
uptime: "medium",
251+
member: true,
252+
},
253+
} as const satisfies { [key in "standard" | "advanced"]: PresetConfig };

0 commit comments

Comments
 (0)