---
alwaysApply: true
---

the “phluid” repo consists of the following components (all pathnames are relative to the root of the repo):
- a server built with rails and sqlite3 running on ubuntu
- a client built with javascript, jquery, and sqlite3 wasm
- a rest interface between them
- automated tests using playwright

server:
- resides in the rails/ directory which itself has the standard structure of a rails app
- all html delivered to the browser is converted from haml files in the rails/app/views/public/ directory
- all javascript, wasm, and css files delivered to the browser are in the rails/public/ directory

client:
- use flexbox layout by default unless a significantly more optimal approach is available
- consists of an App singleton (in class_app.js) which displays one of two “panes”:
   + a “view define” pane materialized by the ViewDefine singleton (in class_view_def.js)
   + a “view” pane materialized by an instance of the View2D class (in class_view_2d.js)
- two dialogs can be activated in the view define pane, each of which is materialized by dedicated singletons:
   + FilterDate singleton (in class_filter_date.js)
   + VisualColor singleton (in class_visual_color.js)
- four dialogs can be activated in the view pane, each of which is materialized by instances of the following classes:
   + TaskCreate (in class_task_create.js)
   + TaskEdit (in class_task_edit.js)
   + StatusMenu (in class_status_menu.js)
   + DayClear (in class_day_clear.js)
- in addition, an instance of the DND class (in class_dnd.js) is dedicated to handling drag-and-drop operations in the view pane

when emitting ruby source code:
- all indents should be in multiples of 3 spaces
- put a single space:
   + around operators and equal signs, e.g. let x = y + z
   + after “(“ and before “)”, e.g. let x = ( y + z ) * 3; def foo( )
   + after “[“ and before “]”, e.g. [ foo ]; [ ]
   + after “{“ and before “}” if they are on the same line, e.g. { }; { foo: “bar” }; “x #{ y } z”
   + after commas separating function arguments and array elements, e.g. foo( x, y ); [ x, y ]
   + after opening “|” and before closing “|” when used for enclosing block arguments
- enclose all strings in double quotes unless alternatives are more optimal
- enclose all code blocks attached to method calls in curly braces
- enclose all method arguments in parentheses
- do not use “unless”, use “if !”
- do not use “until”, use “while !”

when emitting javascript source code:
- use features available up to and including ES13
- use multiple of 3 spaces for indentation
- do not put semi-colons at the end of statements unless it’s absolutely necessary
- enclose all strings in double quotes unless alternatives are more optimal
- put a single space:
   + around operators and equal signs, e.g. let x = y + z
   + after “(“ and before “)”, e.g. let x = ( y + z ) * 3; function foo( )
   + after “[“ and before “]”, e.g. [ foo ]; [ ]
   + after “{“ and before “}” if they are on the same line, e.g. { }; { foo: “bar” }; `x ${ y } z`
   + after commas separating function arguments, e.g. function foo( x, y, z )
- format if-else statements as:
   > if ( condition ) {
   >
   >   // statements
   >
   > } else {
   >
   >   // statements
   >
   > }
