Commit Graph

65 Commits

Author SHA1 Message Date
ConorB 4003446137 Switch from @shopify/web-worker to postMessage for useCompareExtension (#717)
* Switch from @shopify/web-worker to postMessage for useCompareExtension

* Type safety

* make formatting consistent

---------

Co-authored-by: ConorBobbleHat <c.github@firstpartners.net>
2023-03-27 10:07:15 +09:00
Alex Bates d81d131a43 Update dependencies (#705)
* misc changes

* remove yarn.lock

* update poetry lockfile

* fix env variables in browser

---------

Co-authored-by: Ethan Roseman <ethteck@gmail.com>
2023-03-20 00:33:01 +09:00
Alex Bates 4cf3e416e5 Use Next.js 13 app directory & Tailwind CSS (#626)
- Use Next.js 13 app directory for all routes except projects
- Add Tailwind (resolves #619) and use it for most components
- New footer
- Adjust navbar (logotype, buttons moved to right)
- Improve the styling of the search box
- New /settings/account page
- /credits grabs contributors list for this repo from GitHub's API
- Resolve #634
- New welcome page header with scrolling platform icons
2023-01-03 12:41:05 +00:00
Alex Bates 04a5a32c07 Upgrade to Next.js 13 (#618)
Resolves #610.
2022-12-19 23:11:57 +09:00
ConorB 44c0ecd6cc Move logic of useCompareExtension to a Web Worker (#605)
Closes #545.
2022-12-17 17:08:56 +00:00
Ethan Roseman 9651b7dcf2 A few issues (#603)
Fixes #312 - removes login event from plausible
Fixes #249 - adds the course db models
Fixes #583 - allow viewing target asm even when the scratch doesn't
initially compile

Update frontend & backend deps
2022-12-14 23:40:41 +09:00
Ethan Roseman acf47167b3 update everything (#599) 2022-12-08 22:48:08 +09:00
Alex Bates 2e96373ac7 Projects list, creation, settings pages (#542)
* add projects list

* new project page

* mypy

* allow '.' in github identifiers

* implement project create

* project settings

* disallow anons from being project members

* uploadable project icon

* docker attempt

* fix tests

* add tests

* add description form

* refactor to add useEntity and FieldSet

* move FieldSet out of subdirectory

* use same page for project tabs

* scroll up to UnderlineNav when tab changes

* stylelint

* configure vscode mypy extension

* mypy

* fix mypy and dmypy

dmypy does not support follow_imports=silent. Instead we explicitly
disable most checks for asm_differ and m2c, which
has the same effect

* remove redundant mypy flags

* FieldSet style tweaks

* give UnderlineNav horiz padding

* fix swr mutate of project header

* few tweaks to help docker (#550)

* eth changes

* use POST/DELETE rather than PUT for project members

* add migration

* fix pr creation

* simplify project platform derivation

Co-authored-by: Mark Street <22226349+mkst@users.noreply.github.com>
Co-authored-by: Ethan Roseman <ethteck@gmail.com>
2022-10-07 20:12:18 +09:00
Alex Bates 00cf81c7b9 Fit scratch toolbar onto one row when possible (#548)
* refactor scratch actions to its own component

* move toolbar actions into nav area

* fit ScratchToolbar on one line where possible

* fix HydrationError

* reduce wasted space by calculating layout in js

* avoid layout shift when edit time changes

* move edit time next to scratch name

* stop showing "Active now" after time

* align edit time on baseline

* drop 'Edited' prefix
2022-09-21 17:20:44 +09:00
Alex Bates b17d647999 update next-pwa and next-translate (#549) 2022-09-21 16:10:15 +09:00
Alex Bates b46b318d38 #539 again (#541)
* Revert "Revert "Frontend performance/accessiblity tweaks (#539)" (#540)"

This reverts commit 01a6ad58d5.

* don't use swc
* make useCompilation error detecting more resilient
* add browserslist
* supply sizes prop to UserAvatar Image
* be less specific about error type
2022-09-19 14:42:59 +01:00
ConorB 4c20bf69fa Switch line diff implementation (#543) 2022-09-18 07:52:15 -10:00
Ethan Roseman 01a6ad58d5 Revert "Frontend performance/accessiblity tweaks (#539)" (#540)
This reverts commit be2bb90c01.
2022-09-17 16:13:43 -04:00
Alex Bates be2bb90c01 Frontend performance/accessiblity tweaks (#539)
* update eslint for next.config.js

* add webpack-bundle-analyzer

* use next/future/image

* improve text contrast in various places

* render scratch page on server

* fix username color on user page

* add title to commit hash

* fix apple-touch-icon

* remove user-scalable=no

* oops
2022-09-17 15:15:03 -04:00
Alex Bates bd8d7c342e Move redecompilation to an editor tab & add fork diffing (#528)
* add lazy tab content rendering

* improve renderTab typing

* change decompilation modal to a tab

* diff decompilation against source code

* highlight different lines

* fix gutter to not mistakenly show removed lines

* clean up cod

* debounce decompilations

* diff code against parent scratch

* add compare forks setting

* fix breadcrumbs margin

* delay compare for editable codemirrors

* reduce rerenders when typing quickly

* add sanity check for doc-out-of-sync bug

* fix out-of-sync bug

* compare against fork parent when scratch is not modified

* make decompile tab dismissable

* fix stylelint
2022-09-15 21:38:23 +01:00
Alex Bates 935828bf35 Add appearance options (#523)
* add auto light theme

* increase editor contrast

* improve settings page, add theme picker

* don't rehydrate when clicking settings tab

* add code font family setting

* add code line height setting

* add code color scheme editor

* base selection/highlight colors on background not site theme

* add footer to settings page

* fix /settings links

* add color scheme presets

* fix lil bugs

* update diff colors

* darken light colorscheme bg

* 'Preferences' -> 'Settings'

* bump stylelint

* fix stylelint issues

* combine diff/code font size settings

* fix diff column distribution bug

Introduced in #520

* remove save/fork duplicate button from scratch toolbar right

* move compile button

* move settings button to nav

* allow styling cm gutter color

* fix editor height on settings

* act as sidebar when nav is toggled on large widths

* improve breadcrumb styling

* improve search styling
2022-09-14 12:15:23 +01:00
Alex Bates e012b47a01 Mobile fixes & new scratch toolbar (#520)
* new mobile nav

* desktop nav

* nav style tweaks

* fix new page

* use standard nav on scratch page

* prepare scratch layout for #266

* add fixme to defaultsize

* redesign ScratchToolbar

* add more links to nav menu

* don't display online marker on yourself

* disable user-scaling on scratch page

* fix small width overflow on index page

* disable scrolling on scratch page

* try fix codemirror teleportation bug

* fix #519

* patch over diff_flags type issue

* remove padding-right from loginstate

* responsive scratch layout

* fix warning

* remove progress bar

Was causing overflow-x issues

* use floating scrollbar on macos

* fix editor overflow
2022-09-13 23:57:05 +09:00
Ethan Roseman db03a48ef9 Revert the reversion of the updates (#459)
* Revert "Revert "Dep updates (#457)" (#458)"

This reverts commit eb43c51586.

* ci changes

* Update almost everything, fix issues

* add jest-environment-jsdom

* fix to mwcc debug info option

* remove frontend tests

* black

* remove eslint-plugin-testing-library

* Do db migration

Co-authored-by: Alex Bates <alex@nanaian.town>
2022-06-01 23:06:51 -04:00
Ethan Roseman eb43c51586 Revert "Dep updates (#457)" (#458)
This reverts commit 03ae189510.
2022-05-31 18:40:21 +09:00
Ethan Roseman 03ae189510 Dep updates (#457)
* Update python deps and remove extra stuff from mac compiler command

* git subrepo pull --force backend/asm_differ

subrepo:
  subdir:   "backend/asm_differ"
  merged:   "9b2b6ad5"
upstream:
  origin:   "https://github.com/simonlindholm/asm-differ"
  branch:   "main"
  commit:   "9b2b6ad5"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

* git subrepo pull --force backend/mips_to_c

subrepo:
  subdir:   "backend/mips_to_c"
  merged:   "10184592"
upstream:
  origin:   "https://github.com/matt-kempster/mips_to_c"
  branch:   "master"
  commit:   "10184592"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

* prep for mips_to_c -> m2c migration

* rename m2c directory

* update frontend deps
2022-05-31 18:33:26 +09:00
alex 9b31c9ebb8 Add family page & diff label editor (#438)
* add 'parent' url to TerseScratchSerializer

* add family page

* link to family in AboutScratch

* bump react-laag

* ui to edit diff label

* use User-Agent Client Hints API if supported

* fix pwa icons

* use carets instead of slashes between breadcrumbs

* use breadcrumbs on project function page

* fix save problem

* allow diff_label on compile

* a

* change placeholder

* new diff flags fix

* diff flags stuff

Co-authored-by: Ethan Roseman <ethteck@gmail.com>
2022-04-13 23:21:40 +09:00
alex 70992ac3ae CodeMirror extension changes (#430)
* increase vertical diff padding

* improve codemirror extensions

* remove scratch state debouncer

* update codemirror theme
2022-04-02 23:20:37 +09:00
alex a3e3f6ed7b Frontend fixes (#429)
* fix decompile modal  codemirror height

* bump browserslist

* fix scrollbars

* remove storybook, update things

* fix editor styling

Co-authored-by: Ethan Roseman <ethteck@gmail.com>
2022-04-02 22:00:43 +09:00
Ethan Roseman d9a17b3eb1 frontend updates (#425) 2022-04-01 00:59:10 +09:00
Ethan Roseman 8ea10ca286 CodeMirror & PresetSelect fix (#413)
* yarn upgrade

* update eslint no-multiple-empty-lines rule

* update Next.js & React

Resolves #358.

* use CodeMirror in scratch editor

* use codemirror on new page

* move extensions out of CodeMirror component

* grow scratch codemirror

* fix state bug

* initial theming

* fix scratch page SSR

* fix credits page rendering

* max width for AsyncButton error popup

* word wrap

* bye monaco

* cleanup

* style scrollbars everywhere

* tab stuff

* updates

* more

* update codemirror theme

* new react, backend deps, preset on scratch, bugfixes

* improve monospace areas

* store preset name on scratch

* stylelint

* mypy

* mypy 2

* monospace

* fix monospace

* add padding to editor

* fix saving

* fix selection colours

* Highlight assembly line on source selected line change (#416)

Co-authored-by: Alex Bates <hi@imalex.xyz>

* mypy & black

* font stuff

* remove courier new

* make diff style consistent with editor

* fix codemirror exception when editing eof

* attempt to reduce layout thrashing

* /new: store presetName in localStorage

* use react-window for diff

* link diff column scroll position

* hide double scrollbar

* increase overscan

* pointer-events:none on diff header

* fix diff header thing

* make diff columns non-draggable

* dont shrink tabs

* add draggable bar between diff columns

* remove log

* fix 2-col mode

* fix diff align

* DiffCell support cell=undefined

* drag better

* style .cm-search

* eth style changes

* reduce rerenders when dragging diff bar

Co-authored-by: Alex Bates <hi@imalex.xyz>
Co-authored-by: hatal175 <hatal175@users.noreply.github.com>
Co-authored-by: Alex Bates <alex@nanaian.town>
2022-03-31 22:22:39 +09:00
Ethan Roseman 2bfbe4583d Revert "Upgrade dependencies - eth (#405)" (#407)
This reverts commit 15977c0b8a.
2022-03-18 03:36:28 +09:00
Ethan Roseman 15977c0b8a Upgrade dependencies - eth (#405)
* Upgrade dependencies - eth

* oopz

* do what alex did

* more - fixes #403

* revert stylelint update
2022-03-16 06:16:21 +09:00
Ethan Roseman 6b1ee90acd Compiler/platform refactor (#396)
* foyst

* clang & agbcc

* more

* wii/gc

* more

* fix

* more

* references

* fixes

* CI fix

* nabbed em

* gcc2.7.2kmc

* meowp

* Tweak Dockerfile + other bits (#398)

* Tweak Dockerfile + other bits

* Capitalise

* Enable/disable compiler downloads via Environment variables

* appease black

* migration

* flags / presets in Compiler

* fixed tests

* /compilers

* mypy cheese

* upd8s

* name

* frontend goodness

* i18n

* cleaners

Co-authored-by: Mark Street <22226349+mkst@users.noreply.github.com>
Co-authored-by: Mark Street <streetster@gmail.com>
2022-03-14 02:33:19 +09:00
Alex Bates 1968531ca4 Projects MVP (#292)
Co-authored-by: Matt Kempster <kidpixel@gmail.com>
Co-authored-by: Mark Street <streetster@gmail.com>
2022-02-18 17:48:51 +00:00
Ethan Roseman 662818bf8d Decompile gooey (#360)
* add "Reset source code" button

* dedup modal css

* Eth's delivery of delectable dinner

* rename ScratchResetModal to ScratchDecompileModal

* consistent state

Co-authored-by: Alex Bates <hi@imalex.xyz>
2022-02-18 03:58:28 +09:00
Léo Lam f8bd61f4f3 frontend: Translate ANSI color codes to HTML colors (#344)
Allows Clang's pretty color diagnostics to show up correctly
2022-02-07 22:04:22 +09:00
Alex Bates 09378167a8 Add plausible analytics to frontend (#311)
* add next-plausible

* add analytics events to key actions

* use stats.decomp.me

* don't run frontend tests on windows runner

buggy github action
2022-01-14 01:30:37 +09:00
Alex Bates 8c8607c562 Fix preferences dialog on Safari (#296) 2022-01-06 14:06:55 +00:00
Alex Bates 110ce88357 Index page (#295)
* index page

* set index title

* cleanup

* at footer to 404

* move /scratch/new to /new

* fix update_scratch_score updating the scratch even if not required

* remove projects from index

* fix errors if you lack an avatar

* extra metadata in ScratchList

* add home button to scratch menu
2022-01-06 23:00:39 +09:00
Alex Bates b96dd0315d ScratchViewSet + search box (#285)
* initial scratch viewset impl

* use scratch2 on frontend

* todo

* viewset

* permissions

* fix mypy

* add TerseScratchSerializer

* mypy

* add FRONTEND_BASE

* add search box

* use get_html_url

* scratch default name

* always show search icon

* oops

* add platform icon to search results

* very oops

* improve searchbox stability

* fix requirements

* don't autosave on compiler change

* add Search to ScratchToolbar

* Nav frog padding tweak

* frog hover state

* click away bug

* fix weird search result click bugs

* recompile on visit another scratch
2022-01-04 03:00:12 +09:00
Alex Bates b755c55ef8 Add settings page (#270)
* nav user menu popup

* add settings page

Fixes #61.

* use real links for menu links

* lint

* allow access to UserMenu when signed out

* mark comment

* rename 'Scratch settings' tab

* add platform logo to compileropts + give tab min width

* lint

* toolbar hamburger

* draggable diff bar

* scratch preferences modal

* prevent long names from breaking ui

* no scrollbar on vertical tabs

* AboutScratch overflow fixes

* update right pane width

* responsiveness

* toggle menus on multiple clicks

* temporarily remove settings link

* better scratch name behaviour on small widths

* remove nav from scratch page

* implement export

* menu style changes

* scratch name cursor:text

* lint

* don't use focus-visible

Unsupported on Safari

* show loading spinner in ButtonItems

* shortcuts

* footer credits icon

* add icons to scratch menu

* compile scratch in SSR

* score in AboutScratch

* give the toolbar its colour back

* diff compile changes

* give editable scratch name a hover state

* improve editor preferences ui

* tricolor toolbar,tabs,panels

* reduce diff header blur

* tweak scratch name bg color

* pass tests
2022-01-02 16:39:33 +09:00
Alex Bates 8a6dc722c9 Windows (#239)
* run tests on windows also

* postinstall: don't pipe to /dev/null as this doesnt work on windows

* make backend_test_windows into its own workflow

* skip tests where compiler is not supported

* fix mypy
2021-12-21 00:57:53 +09:00
Alex Bates 467c9142e8 Add frontend testing (#182) 2021-10-16 13:37:43 +01:00
Alex Bates 0e8b01841a Frontend improvements + Docker updates (#167, #169)
Co-authored-by: Mark Street <22226349+mkst@users.noreply.github.com>
2021-10-14 12:52:28 +01:00
alex 7757386396 Migrate to Next.js + big style update (#154)
* Backend changes to diff from label rather than 0, also possibly fix #109

* implement diff_label frontend & fix assemble_asm

* Log stack trace if asm-differ fails

* don't return { obj } from api

* slight change in stub func code

* GET /compilers returns arches for compilers

* GET /compilers returns arches for compilers

* keep compiler_ids

* Obtain ido from download script, add comment for permuter api support

* Clean m2c wrapper code, add left pointer style, add test

* fix 3 tests

* list arches from api

* fix cookies in DEBUG

SameSite=None is incompatible with Secure, and this causes some browsers
to ignore the cookie altogether.

* fix test

Regression due to changing API to not return { "user": User } but
rather just the User object itself.

* fix create scratch without glabel

This works around a backend bug

* add label select on scratch creation

* show compilers/presets for current arch only

- fixes #92
- fixes #132

* fix mypy issues

* use react instead of preact

* hold pages in src/pages/

This matches NextJS file structure; the names of files reflect their routing paths.

* migrate to NextJS

* use next-pwa

* statically generate user page

* fix github login

* add loading progress bar

* arch on scratch

* nav redesign

* use .env.local instead of local.env

* fix unset compiler not considering arch

* add discord server to readme

* big styling update

* add footer

* move compiler dir into components

* use lib dir

* fix ts error

* describe deployment

* dont use NEXT_PUBLIC_* in .env

* add storybook

* document storybook

* make AsyncButton loading state pretty

* remove sharp

* custom monaco editor react component

* ci: build frontend

* allow nextjs to build despite ignored typescript errors

* ci

* remove react-loading-skeleton

* oops

* don't request public_repo github scope

* give AsyncButton error popup its arrow back

* try fix monaco problem

* oops

* fix monaco red bg for real this time

Co-authored-by: Ethan Roseman <ethteck@gmail.com>
2021-10-13 00:49:23 +09:00
alex 537eff9a95 Merge branch 'main' into dotenv 2021-09-23 13:25:54 +01:00
alex 5f33326703 update readme and read from local.env 2021-09-17 17:10:06 +01:00
alex 884a292f91 rewrite scratch component 2021-09-04 15:10:25 +01:00
alex 9c3816adee use reviewdog.yml 2021-08-28 01:16:26 +01:00
alex 7d5d872a07 check eslint and typescript
Resolves #99.
2021-08-28 00:36:04 +01:00
alex 706996d71a user pages + use typescript
Partially fixes #99 (needs CI).
Partially implements #105 (still needs scratch list).
2021-08-27 22:54:16 +01:00
alex 3797395d3a add GitHub login 2021-08-27 18:01:21 +01:00
alex e8c8666d75 fix monaco bugs 2021-08-26 13:27:44 +01:00
alex 90f83fd11e fix #55 2021-08-25 22:52:32 +01:00
alex b056bcfe25 update frontend for new api 2021-08-09 15:38:38 +01:00