Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
251 commits
Select commit Hold shift + click to select a range
868b65d
flatten knows language
SharonStrats Apr 24, 2026
d7119fd
test refresh add friend
SharonStrats Apr 24, 2026
0707c09
comment in forms helper file
SharonStrats Apr 24, 2026
1a813de
clean up
SharonStrats Apr 24, 2026
27bbd50
more cleanup
SharonStrats Apr 24, 2026
7495e3b
move qrcode section
SharonStrats Apr 24, 2026
d79df1a
remove unnecessary types
SharonStrats Apr 24, 2026
fcf0f35
a11y
SharonStrats Apr 24, 2026
207479b
testing
SharonStrats Apr 24, 2026
b1a4c7a
style cleanup
SharonStrats Apr 24, 2026
4c25f43
more testing
SharonStrats Apr 24, 2026
1d4a456
Merge branch 'main' into milestone3m-extend
SharonStrats Apr 24, 2026
c47cce2
mini refactor
SharonStrats Apr 26, 2026
6122d17
ESCO latest version
SharonStrats Apr 26, 2026
bbfd029
projects paste btn styles
SharonStrats Apr 26, 2026
16eee75
add a spinner to the dialog
SharonStrats Apr 27, 2026
93aca33
fallback patch error
SharonStrats Apr 27, 2026
d617773
change to saving
SharonStrats Apr 27, 2026
60eee34
skill styles for owner
SharonStrats Apr 27, 2026
40a8749
edit box padding
SharonStrats Apr 27, 2026
cecc02b
skills spacing
SharonStrats Apr 27, 2026
b8e0cdb
detailed skills styling
SharonStrats Apr 27, 2026
2b9a9c0
lang section detailed styling
SharonStrats Apr 27, 2026
0f1698c
fix minor styling issues
SharonStrats Apr 27, 2026
55bbaf2
major css refactor
SharonStrats Apr 27, 2026
7065983
fix tests from refactor
SharonStrats Apr 27, 2026
0ad40b9
minor social css
SharonStrats Apr 27, 2026
477701f
update cpl tests for css change
SharonStrats Apr 27, 2026
beda611
axe testing
SharonStrats Apr 27, 2026
3bc9438
fix import error
SharonStrats Apr 29, 2026
d5f667c
use basic select web component for contact point types
SharonStrats Apr 29, 2026
eab76b1
add select comp to resume
SharonStrats Apr 29, 2026
da97392
add select to social
SharonStrats Apr 29, 2026
bba3ed8
add select to education
SharonStrats Apr 29, 2026
27ed34c
clean up unneeded css
SharonStrats Apr 29, 2026
ae3888a
refactor skills to be more like language
SharonStrats Apr 29, 2026
207cbe1
use combo in skills
SharonStrats Apr 29, 2026
3133f09
use combobox in lang
SharonStrats Apr 29, 2026
d83a22a
clean up styles from change
SharonStrats Apr 29, 2026
a0b996d
fix test
SharonStrats Apr 29, 2026
2073bc3
webpack dev add combobox
SharonStrats Apr 29, 2026
c4dfdc4
lint fix
SharonStrats Apr 29, 2026
32be821
take out watch from dev
SharonStrats Apr 29, 2026
f41c62a
Merge branch 'main' into post-milestone3m
SharonStrats Apr 29, 2026
249f866
generative ai messages
SharonStrats Apr 29, 2026
d94209c
test: cover aggregated profile view
SharonStrats Apr 29, 2026
b26f4c9
clean up mutations
SharonStrats Apr 30, 2026
5687c26
gen ai readme
SharonStrats Apr 30, 2026
52fe138
more mutation refactor
SharonStrats Apr 30, 2026
7406559
refactor: move QRcode hydration into QRCodeCard module
SharonStrats Apr 30, 2026
e4a4f71
refactor: standardize section renderer naming
SharonStrats Apr 30, 2026
e23978d
integration cov for profile
SharonStrats Apr 30, 2026
c448d75
remove debug logging from social and qrcode
SharonStrats Apr 30, 2026
93030e7
refactor: texts
SharonStrats Apr 30, 2026
5f8a075
unused var eslint plus cleanup
SharonStrats Apr 30, 2026
5517793
clarify rdfFormsHelper as active shared form integration code
SharonStrats Apr 30, 2026
49edc03
remove redundant aria-label from sidebar wrapper
SharonStrats Apr 30, 2026
83b533b
document manual accessibility workflow beyond axe checks
SharonStrats Apr 30, 2026
4a420b6
add dialog keyboard focus interaction coverage
SharonStrats Apr 30, 2026
11b031c
accessibility smoke test checklist
SharonStrats Apr 30, 2026
0e2d6f2
fix stale social section tests after renderer changes
SharonStrats Apr 30, 2026
36d4b8c
cleanup
SharonStrats Apr 30, 2026
52aa70e
heading accessibility
SharonStrats Apr 30, 2026
04d47b0
wire up pronouns to use select web comp
SharonStrats Apr 30, 2026
44be1ff
fix current checkbox regression
SharonStrats Apr 30, 2026
7635dbd
fix typescript errors
SharonStrats Apr 30, 2026
cf458d1
wire up photo capture web component
SharonStrats Apr 30, 2026
154814d
lint fix
SharonStrats Apr 30, 2026
76eb1ad
add to contacts button (still needs some style
SharonStrats Apr 30, 2026
0497692
use env context in dev
SharonStrats May 1, 2026
e7118df
add layout mobile to css
SharonStrats May 1, 2026
05ae10c
migrate profile pane buttons to solid-ui-button
SharonStrats May 2, 2026
07cc91b
add profile pane environment attributes
SharonStrats May 2, 2026
96ce31b
clean up bio and qr layout utilities
SharonStrats May 2, 2026
ee1a48a
fix tests
SharonStrats May 2, 2026
dd39008
Remove redundant solid-ui button roles and stabilize axe tests
SharonStrats May 2, 2026
1a7683f
add inputMode funct
SharonStrats May 2, 2026
ed05f01
minor style changes
SharonStrats May 4, 2026
35e6823
mobile styles
SharonStrats May 4, 2026
d0b9132
remove unused icons
SharonStrats May 4, 2026
bb0b7c9
some button cleanup
SharonStrats May 4, 2026
b163c46
fix empty button on profile
SharonStrats May 5, 2026
e13346b
fix buttons on section
SharonStrats May 5, 2026
6c20a13
add to contacts dialog styling
SharonStrats May 5, 2026
f21395c
change from data-layout to mashlib-layout
SharonStrats May 5, 2026
96b50b3
Revert "change from data-layout to mashlib-layout"
SharonStrats May 5, 2026
7450207
headign styles
SharonStrats May 5, 2026
d9accb0
address book styles
SharonStrats May 5, 2026
0da3eb9
Merge branch 'main' into post-milestone3m
SharonStrats May 5, 2026
af33a70
fix padding
SharonStrats May 6, 2026
2864bf7
move edit back to top right on mobile
SharonStrats May 7, 2026
5d6fd4f
heading tests
SharonStrats May 7, 2026
a2d6c8d
fix side bar layout on mobile
SharonStrats May 7, 2026
85f038a
add to friends styling
SharonStrats May 7, 2026
8b12f00
style improvement
SharonStrats May 7, 2026
72781b2
project empty section impr
SharonStrats May 7, 2026
5ad29f7
resume empty improvements
SharonStrats May 7, 2026
49c3a0c
testing
SharonStrats May 7, 2026
200eb05
shared helpers
SharonStrats May 7, 2026
4949561
special buttons
SharonStrats May 7, 2026
423b1c8
mutation refactor
SharonStrats May 7, 2026
f513f9d
fix pronouns
SharonStrats May 8, 2026
147b95e
fix pronoun label space
SharonStrats May 8, 2026
78a6e14
restructure layout to better match design
SharonStrats May 8, 2026
8df0172
styling edit dialogs
SharonStrats May 8, 2026
81684db
qr text
SharonStrats May 8, 2026
97bb821
social edit pop open on select acct
SharonStrats May 8, 2026
81575ff
unfollow hover
SharonStrats May 8, 2026
29870a0
no icon on hover
SharonStrats May 8, 2026
ac4d526
close when save and no input change
SharonStrats May 8, 2026
ad94004
focus first input on combobox
SharonStrats May 8, 2026
452343e
fix test
SharonStrats May 8, 2026
a21e835
refactor close no data
SharonStrats May 8, 2026
31f4c0a
lint errors
SharonStrats May 8, 2026
7a168ca
add to contact dialog styling
SharonStrats May 9, 2026
420e8bf
style more and less buttons
SharonStrats May 9, 2026
5b8967b
debug - no console
SharonStrats May 9, 2026
1990485
allow non esco skills
SharonStrats May 9, 2026
2b89f40
add search to org name
SharonStrats May 9, 2026
5b613e3
improve vars
SharonStrats May 10, 2026
22aff0d
add to contacts named buttons
SharonStrats May 10, 2026
4d095d2
add vars to dev
SharonStrats May 10, 2026
0401842
error handling refactor
SharonStrats May 10, 2026
c2509e2
add prefix on data
SharonStrats May 10, 2026
c3b1d41
refactor css some gen global color vars
SharonStrats May 11, 2026
12966d3
bio section css cleanup
SharonStrats May 11, 2026
7a90b63
add friends button css cleanup:
SharonStrats May 11, 2026
aeac609
contact info css refactor
SharonStrats May 11, 2026
3cecbec
phone +1 remove
SharonStrats May 11, 2026
9b6841b
add to contacts css refactor
SharonStrats May 11, 2026
7dde9e7
language section css refactor
SharonStrats May 11, 2026
413b520
qrcode css refactor
SharonStrats May 11, 2026
53f0923
fix responsive page
SharonStrats May 11, 2026
25b43be
qrcode styles
SharonStrats May 11, 2026
96017ee
skills css refactor
SharonStrats May 11, 2026
140b027
Merge branch 'main' into post-milestone3m
timea-solid May 11, 2026
edff89c
css refactor plus fixes
SharonStrats May 11, 2026
b600aa3
Merge branch 'post-milestone3m' of https://github.com/SolidOS/profile…
SharonStrats May 11, 2026
6b502b1
fix typescript errors
SharonStrats May 11, 2026
1ccd913
mobile spacing
SharonStrats May 11, 2026
73ca89c
resuem styling
SharonStrats May 11, 2026
6844886
UI fixes (#311)
NoelDeMartin May 11, 2026
96b06b7
fix qrcode styling
SharonStrats May 11, 2026
f54aa92
fix layou & remove util
SharonStrats May 11, 2026
24f7bc9
global color vars
SharonStrats May 11, 2026
021d787
Merge branch 'post-milestone3m' of https://github.com/SolidOS/profile…
SharonStrats May 11, 2026
4d57e27
fix qrcode styling & a11y
SharonStrats May 11, 2026
2a42f17
move profile css
SharonStrats May 11, 2026
b929165
moved dialog css
SharonStrats May 11, 2026
e8dd151
move bio section css
SharonStrats May 11, 2026
1d02e57
perfect qrcode
SharonStrats May 12, 2026
34687b3
fix social reg and move css file
SharonStrats May 12, 2026
a9385df
remove utils
SharonStrats May 12, 2026
b1a161a
fix mobile layout mashlib
SharonStrats May 12, 2026
77ecb31
Merge branch 'main' into post-milestone3m
SharonStrats May 12, 2026
4d5f769
babel: add --copy-files parameter to copy collocated css files to lib
May 12, 2026
97ff00c
peer dependency
May 12, 2026
15989ba
better debugging
SharonStrats May 13, 2026
00c0e5e
error msg on unfollow and skill removal
SharonStrats May 13, 2026
dc3e094
first pass spinners on unfollow and skill del
SharonStrats May 13, 2026
5aaa04d
fix tests
SharonStrats May 13, 2026
96411b0
clean up unused texts
SharonStrats May 13, 2026
40203ef
json lock
SharonStrats May 13, 2026
7eeadba
fix up error handling styling
SharonStrats May 13, 2026
0828a6f
dont display Already Friends button on mobile
timea-solid May 13, 2026
3dfcae3
padding changes
SharonStrats May 13, 2026
91658d7
Merge branch 'post-milestone3m' of https://github.com/SolidOS/profile…
SharonStrats May 13, 2026
8054eb6
fix layout issues
SharonStrats May 13, 2026
c632d7b
remove add to contacts button
SharonStrats May 13, 2026
9703669
hide btn in css
SharonStrats May 13, 2026
00b05a8
#310 Remove redundant headings
NoelDeMartin May 13, 2026
12cbf9b
#310 Fix sidebar heading levels
NoelDeMartin May 13, 2026
1815d9c
#310 Show incorrectly hidden content
NoelDeMartin May 13, 2026
f492115
Merge pull request #317 from NoelDeMartin/milestone3m-noel
SharonStrats May 13, 2026
7e39e8c
edit prof a11y fix from Michael
SharonStrats May 13, 2026
9064c80
qrcode background color
SharonStrats May 14, 2026
65bddc7
collapsible + mobile
SharonStrats May 14, 2026
5de5dc3
empty sec add more
SharonStrats May 14, 2026
ef96005
icon + text buttons
SharonStrats May 14, 2026
4b8e179
fix tests
SharonStrats May 14, 2026
fc543dd
make mobile work in mashlib
SharonStrats May 14, 2026
5ae94ee
refactor edit dialog styling & fix bug with image upload
SharonStrats May 14, 2026
058182c
Merge branch 'post-milestone3m' of https://github.com/SolidOS/profile…
SharonStrats May 14, 2026
ef71a12
first pass work on phones
SharonStrats May 14, 2026
c6bc5b8
few more style changes on mobile
SharonStrats May 14, 2026
7f436a9
fix typecheck
timea-solid May 14, 2026
d6687c4
container mis style
SharonStrats May 14, 2026
3f4c766
Merge branch 'post-milestone3m' of https://github.com/solidos/profile…
SharonStrats May 14, 2026
14d1e81
sizing heading and social
SharonStrats May 15, 2026
7508adb
containersection pad mobile
SharonStrats May 15, 2026
172e189
move css file next to ts
SharonStrats May 15, 2026
bceaf01
contact info edit dialog css improvements
SharonStrats May 15, 2026
8b62a98
fix file loc errors
SharonStrats May 15, 2026
9e2d2b2
contact info edit dialog styles
SharonStrats May 15, 2026
cec6629
collapse at 700 not 1000
SharonStrats May 15, 2026
4e37410
style cleanup
SharonStrats May 15, 2026
25cb7f9
remove regression add more button on proj and resume
SharonStrats May 15, 2026
9c8b7b6
fix container bugs
SharonStrats May 15, 2026
7bb1348
fix package files
SharonStrats May 15, 2026
dc2a838
wrap later
SharonStrats May 15, 2026
0b67f5e
padding on project section desktop
SharonStrats May 15, 2026
7eceabe
try something on mobile
SharonStrats May 15, 2026
c6324b8
no utils css
SharonStrats May 15, 2026
c1d7350
organize profile view css
SharonStrats May 15, 2026
efdd12c
mobile layout and container rule
SharonStrats May 15, 2026
37a0a86
icon styling fix
SharonStrats May 15, 2026
f1b7f34
adjust mobile dialog layout
SharonStrats May 15, 2026
1327450
recenter reg of default img
SharonStrats May 15, 2026
09e05b2
head dialog buttons side by side
SharonStrats May 15, 2026
c3d2adb
fix empty main section padding
SharonStrats May 15, 2026
1954d58
refine heading edit dialog layout
SharonStrats May 16, 2026
98068d3
refactor language dialog styles
SharonStrats May 16, 2026
9d0d2c0
fix social header mobile actions
SharonStrats May 16, 2026
9399300
fix dialog desktop centering
SharonStrats May 16, 2026
cd0934e
refactor language section styles
SharonStrats May 16, 2026
f175c5a
hide social edit dialog icon on mobile
SharonStrats May 16, 2026
c9132f2
fix empty state add icon hover color
SharonStrats May 16, 2026
9fa0453
fix language section mobile actions
SharonStrats May 16, 2026
65df5b9
clean up resume section styles
SharonStrats May 16, 2026
f4860cf
adjust resume dialog combobox spacing
SharonStrats May 16, 2026
e029db0
keep email type beside input on desktop
SharonStrats May 16, 2026
dd9b01d
clean up skills section css
SharonStrats May 17, 2026
7011a23
clean up bio section css
SharonStrats May 17, 2026
712d8fc
clean up heading fallback icon styles
SharonStrats May 17, 2026
bbb377c
refine heading section cleanup
SharonStrats May 17, 2026
bad05df
continue heading css cleanup
SharonStrats May 17, 2026
ae1f1ff
Refine heading layout css
SharonStrats May 17, 2026
0c4cf77
Clean up contact info section css
SharonStrats May 17, 2026
f951c51
Persist default contact types
SharonStrats May 17, 2026
183864e
Clean up project section css
SharonStrats May 17, 2026
d21d626
Refine empty and default section spacing
SharonStrats May 17, 2026
cd8d7b0
Refine project card styling
SharonStrats May 17, 2026
9e6bbde
Clean up QR code section css
SharonStrats May 17, 2026
d908b9f
Remove mobile default section gap
SharonStrats May 17, 2026
e3ebc17
Clean up social section css
SharonStrats May 17, 2026
e06dda2
Improve dialog validation and heading saves
SharonStrats May 17, 2026
0a8da3e
Match social mobile section background
SharonStrats May 17, 2026
50b8d46
Split shared edit dialog styles
SharonStrats May 17, 2026
c4bbb08
Add heading action layout regression test
SharonStrats May 17, 2026
d977d21
Add ordered list round-trip tests
SharonStrats May 17, 2026
3e63a57
package
SharonStrats May 17, 2026
3246eff
Add contacts-rdflib dependency
SharonStrats May 17, 2026
a3fe1c9
Fix solid-ui lockfile resolution
SharonStrats May 18, 2026
a3095f7
Improve resume organization search
SharonStrats May 18, 2026
4395dde
Split dialog responsive styles
SharonStrats May 18, 2026
fcbf5f8
Improve skills editing flow
SharonStrats May 18, 2026
811a4e1
Preserve social and language list entry nodes
SharonStrats May 18, 2026
8cfd7de
#347 fix resume headings
SharonStrats May 20, 2026
61015aa
#347 font size for job title hr level change
SharonStrats May 20, 2026
bf89280
Merge pull request #356 from SolidOS/fix/resume-headings
SharonStrats May 21, 2026
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
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@ npm test -- test/profile-view.accessibility.test.ts
Accessibility markup baseline checklist:
[docs/accessibility-baseline-checklist.md](docs/accessibility-baseline-checklist.md)

Manual accessibility smoke test:
[docs/accessibility-smoke-test.md](docs/accessibility-smoke-test.md)

Accessibility workflow:

- Run the focused accessibility test after markup or interaction changes.
- Manually verify keyboard-only use: tab order, reachable controls, visible focus, dialog open/close, and return of focus after dialogs close.
- Manually verify screen-reader output with VoiceOver on macOS for headings, landmarks, button names, dialog announcements, and inline error/status messages.
- Check zoom and reflow at 200% and 400% to confirm content remains readable and usable without horizontal scrolling for core flows.
- If a change affects dynamic UI feedback, confirm success, saving, and error states are announced appropriately.
- Browser-level accessibility audits such as Lighthouse or Playwright/Cypress + axe are not yet wired into repo scripts, so treat the manual checks above as required review work for accessibility-sensitive changes.

Refactor test plan (temporary skips and revisit checklist):
[docs/refactor-test-plan.md](docs/refactor-test-plan.md)

Expand Down Expand Up @@ -61,3 +73,41 @@ npm run build

The build is done by `tsc`, webpack is only used as dev server and not for production build.

## Generative AI usage
The SolidOS team is using GitHub Copilot integrated in Visual Studio Code.
We have added comments in the code to make it explicit which parts are 100% written by AI.

### Prompt usage hitory:
* Model GPT-5.3-Codex: write me a reusable function to open a dialog with a form and return the form values on submit. The function should also support validation and display error messages in the dialog. It should reuse the OpenModal function for consistency.

* Model GPT-5.3-Codex: the description needs to only show 2 lines and then more button please generate code for this.

* Model GPT-5.3-Codex: write me a function to convert a date to Month, Year

* Model GPT-5.3-Codex: The QRCode has a label "link to profile" but it should be a VCARD with name, and link to profile. So when you scan it it goes into your contacts. That's the current way works, IIRC.

* GPT-5.3-Codex Model: 1. are you able to create a little trash can icon at the end of each entry so for each phone, email and address line. 2. are you able to add all the country flags and prefix next to the phone numbers? 3. can you write functions to sanitize the input values for emails, phones, and addresses?

* GPT-5.3-Codex Model: can you have applyAddressFieldChange update the row status based on whether any fields have content

* GPT-5.3-Codex Model: do you see anything I can do differently in the mutation code so that it's not so verbose and possible reusable accross sections

* GPT-5.3-Codex Model: can you implement on SocialEditDialog add the bentoIcon as the first item
on the row, you should be able to drag this button around and it should allow you to change the order of the rows and that should change the order in the mutations that happen for this data.

* GPT-5.3-Codex Model: Write a function handleCameraClick that uses the cameraCaptureControl to
capture an image and update the profile photo in the heading section.

* GPT-5.3-Codex Model: In header selectors select phone and email work type if it exists otherwise pick any.

* GPT-5.3-Codex Model: can you make this a month drop down for the start year

* GPT-5.3-Codex Model: write me a function to determine PastRole, CurrentRole, or FutureRole based on resume role date data. The function should return a NamedNode with the correct solid namespace and role type local name. The function should use the roleType field if it is set to one of those three values, otherwise it should infer the role type based on the start and end dates and isCurrentRole field.

* GPT-5.4 Model: can you add types to rdfMutationHelpers.ts and consolidate mutation logic where appropriate.

* GPT-5.4 Model: can you refactor texts so it's cleaner and easier to update

* GPT-5.4 Model: add keyboard interaction coverage for the shared dialog so we verify initial focus placement and focus restoration when the dialog is cancelled

* GPT-5.4 Model: Use inputMode to toggle interactive cursors
22 changes: 22 additions & 0 deletions TASKS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Profile Pane Task List

## Working Notes
- Mobile changes must be implemented in `layout='mobile'`, container queries, and only the necessary media-query fallbacks. `layout='mobile'` and container behavior are the source of truth.
- Prefer `rem` units and mashlib variables from `light.css` where possible.
- For color styling, use general variables for grays and whites where available. `lavender` and primary color variables are fine as-is.
- Remove utility classes other than `sr-only` and `hidden`. Move styles into specific semantic classes; create specific classes when needed.
- Where possible, make like things share the same class and styling so the same UI is styled once instead of through one-off selectors.

## Current Tasks
- [x] In resume, when tabbing to the company name, highlight the chevron icon v differently. it's like a blue border can you do the purple that happens on the other v for select maybe check all combox maybe they are all not correct only select is... it should be like organization drop down tab for v
- [ ] fix drag and drop in solid-ui. look at socialPane in solid-panes at the bullseye icon for adding friends you can see there what function is called in solid-ui that needs fixing. The other place we need to look is the folder-pane plus icon at the bottom of the page you should be able to drag a file onto that and it will upload the file not open a new tab. Double check this but i think it uses the same solid-ui function as the socialPane bullseye in solid-panes. both of these need to work + on folder pane needs to upload a file and the bullseye needs to add a friend.
- [x] What do you think about teh edit dialog css file is it too big, should we split this up into different css files per section that it is styling. Investigate let me know your thoughts and we will proceed from there.
- [ ] I need to test how the ordered list are working in social section and the languages with the new changes in rdflib please let me know i need to do this when you get to it.
- [ ] on skills the combobox drop down goes over the dialog footer so that all the values can be seen, can you do htat for all the comboboxes the other seem to go underneath the footer. you'll need to look through all the edit dialog and find the ones that have combobox. i can think of resume, social, languages, please double check the others just to be sure. maybe do them one by one and i can check each time adn
we can then commit them separately.

## Notes
- Add new items here as they come up.
- Work through tasks one by one.
- After each task, stop and let the user review it before running `npm run prepush` or making a commit.
- Once the user approves a task, run `npm run prepush`, fix any resulting errors, then commit only the files for that task.
84 changes: 83 additions & 1 deletion dev/context.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import { longChatPane } from 'chat-pane'
//import * as contact from 'contacts-pane' //uncomment for profileEditor
import { DataBrowserContext, PaneRegistry } from 'pane-registry'
import {
DataBrowserContext,
InputMode,
LayoutMode,
LayoutPreference,
PaneRegistry,
RenderEnvironment,
ThemeMode,
} from 'pane-registry'
import { solidLogicSingleton, store } from 'solid-logic'
import { LiveStore } from 'rdflib'

Expand All @@ -11,6 +19,79 @@ if (store.fetcher) {
(store.fetcher as any).withCredentials = false;
}

const MOBILE_BREAKPOINT = 768

function getViewport() {
return {
width: window.innerWidth,
height: window.innerHeight,
}
}

function getInputMode(): InputMode {
return window.matchMedia('(pointer: coarse)').matches ? 'touch' : 'pointer'
}

function resolveLayout(
layoutPreference: LayoutPreference,
viewport = getViewport()
): LayoutMode {
if (layoutPreference === 'auto') {
return viewport.width <= MOBILE_BREAKPOINT ? 'mobile' : 'desktop'
}

return layoutPreference
}

function getInitialTheme(): ThemeMode {
return window.matchMedia('(prefers-color-scheme: dark)').matches
? 'dark'
: 'light'
}

export const environment: RenderEnvironment = {
layoutPreference: 'auto',
viewport: getViewport(),
inputMode: getInputMode(),
theme: getInitialTheme(),
layout: 'desktop',
}

environment.layout = resolveLayout(environment.layoutPreference, environment.viewport)

export function updateEnvironment(
patch: Partial<Pick<RenderEnvironment, 'layoutPreference' | 'theme' | 'inputMode' | 'viewport'>> = {}
): RenderEnvironment {
if (patch.layoutPreference) {
environment.layoutPreference = patch.layoutPreference
}

if (patch.theme) {
environment.theme = patch.theme
}

if (patch.inputMode) {
environment.inputMode = patch.inputMode
}

if (patch.viewport) {
environment.viewport = patch.viewport
}

environment.layout = resolveLayout(
environment.layoutPreference,
environment.viewport
)

return environment
}

export function syncEnvironmentToWindow(): RenderEnvironment {
return updateEnvironment({
viewport: getViewport(),
})
}

export const context: DataBrowserContext = {
session: {
store: store as LiveStore,
Expand All @@ -24,6 +105,7 @@ export const context: DataBrowserContext = {
},
dom: document,
getOutliner: () => null,
environment,
}

export const fetcher = store.fetcher
Loading