Commit Graph
1038 Commits
Author SHA1 Message Date
Rūdolfs Ošiņš fbe133cd95 Load patch list in project router
Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
2023-07-25 11:32:28 +02:00
Thomas Scholtes 1b6bed73a6 Lift branch/peer selector data into main views
We prepare the data for `PeerSelector` and `BranchSelector` in the
`History` and `Browser` instead of `SourceBrowsingHeader`. This makes
the component APIs overall simpler and allows us to remove
`LoadedSourceBrowsingView`.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-24 14:25:53 +02:00
Thomas Scholtes 9c1392598a Simplify BranchSelector
There’s no need for the outer `if branches.length > 0`. We already
disable the dropdown unless `branches.length > 1`.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-24 14:10:26 +02:00
Thomas Scholtes 29e3295f45 Represent issue status filter in route
Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-24 12:15:35 +02:00
Thomas Scholtes dd7f3a850e Simplify project route loading
Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-24 12:15:35 +02:00
Sebastian Martinez f631c7f171 Fix absolute links with files in markdown
We had a regression because of introducing marked-linkify-it, which took
links for CONTRIBUTING.md or HACKING.md as domains of a new page instead
than files to be navigating to.

This commit sets the `fuzzyLink` option for marked-linkify-it to false,
which disables this behavior

Also tests that the browser tree expands itself when navigating to a
file inside a directory

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-07-22 08:02:00 +02:00
Sebastian Martinez 50d046ce86 Fix URL not updating when using navigateInternalOnAnchor
We were always calling `replace` and not passing the desired action in
the `navigateInternalOnAnchor`, this was leading to the URL not updating
when e.g. clicking on file URLs in Markdown renders.

By passing the action to the `navigate` fn instead we can also take the
`push` action into account.

Test have been written to guarantee this works

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-07-21 22:36:53 +02:00
Thomas Scholtes b76db5dfa3 Remove source browsing header from commit view
For a single commit view the source browsing header (peer selector,
branch selector, commits, contributor count) does not contain meaningful
information. We remove the header and simply show the commit.

See #938.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-20 17:14:12 +02:00
Thomas Scholtes c44cd5771b Fix movement of diff text when lines are selected
Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-20 15:56:05 +02:00
xphoniex 5ee8c8281b Make diff line selectable and shareable
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-07-20 11:37:57 +02:00
Thomas Scholtes aae50a2fda Use structured routing for patch views
Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-19 15:14:53 +02:00
Thomas Scholtes fdd074fd13 Simplify BranchSelector and PeerSelector props
We greatly reduce the numbers of properties that need to be passed to
`BranchSelector` and `PeerSelector` by constructing routes in
`SourceBrowsingHeader`. We’ll lift the logic out of
`SourceBrowsingHeader` in a follow-up.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-19 15:00:39 +02:00
Sebastian Martinez afbc57079b Switch page.locator with page.getByRole and page.getByText
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-07-19 11:35:20 +02:00
Sebastian Martinez e4a051b17a Add auto linking in Markdown components
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-07-19 09:07:01 +02:00
Sebastian Martinez 78b988af95 Replace custom extension with marked-katex-extension
- Add a visual test to check math rendering

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-07-17 17:18:07 +02:00
Thomas Scholtes fabd98fb57 Extract tree and history route loading
The `loadProjectRoute` function has become too big too understand. To
address this, we extract and separate the loading for the `tree` and
`history` views. This also gives us the opportunity to simplify some of
the code and parallelize more HTTP requests.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-17 15:48:37 +02:00
Sebastian Martinez 14ba807e55 Set the httpd port for the test suite to be 8081.
Also where possible use the `config.seeds.defaultHttpdPort` instead of
hardcoding it.

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-07-17 15:19:31 +02:00
Sebastian Martinez 69946f5d8c Replace marked namespaces with Marked instance
Based on a new addition to marked, this commits replaces the imported
marked namespaces with a Marked class, that doesn't change when
`marked.use` introduces new options or extensions.

Also changes the naming slighty to use `markdown` as module, so it
sounds more generic.

Reference: https://github.com/markedjs/marked/pull/2831

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-07-17 14:47:53 +02:00
Thomas Scholtes 50088a5c8a Make pathToRoute tests more readable
We switch the test for `pathToRoute` from a paramterized test to regular
tests. I had a lot of trouble finding the right properties to change
when a test in this group failed. The line number was not helpful at all
and the test description was burried inside an object.

We also rename `pathToRoute` to `urlToRoute` because the function takes
a `URL` as an argument.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-17 11:44:27 +02:00
Thomas Scholtes 283b665b31 Switch to flat project route type
We switch to a project route type that is just a union. This has the
following advantages

* It’s much easier to construct project routes. Fewer properties are
  needed and there are no nested objects.
* We eliminate the implicitly shared properties `path`, `peer`,
  `revision` and `route` which only belonged to the tree route.
* The structure of the project route is more regular and thus easier to
  understand.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-17 11:27:57 +02:00
Thomas Scholtes f80b193bbd Don’t intercept navigation to external URLs in Markdown
Fixes 928

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-14 09:29:19 +02:00
Rūdolfs Ošiņš b797c6a3f7 Reverse revision commit ordering
Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
2023-07-14 09:26:34 +02:00
Rūdolfs Ošiņš cdd0b9c7b6 Set page title in the router
This improves UX making it easier to find the tab that I'm looking for
when I have multiple tabs open.

Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
2023-07-14 08:38:15 +02:00
Thomas Scholtes d0ee6e42e6 Simplify ProjectLoadedView
We simplify some of the choices for `ProjectLoadedView` by reducing the
nesting and removing redundant properties.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-12 15:59:46 +02:00
Sebastian Martinez 205fc814bc Bring reactions to comments and issues
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-07-12 15:36:02 +02:00
Thomas Scholtes d0a280be02 Simplify project route resolving
Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-12 15:24:06 +02:00
Thomas Scholtes 9dd3af0f9f Cleanup shared peer and revision props for project route
We move the `peer` and `revision` properties from the shared
`ProjectLoadedParams` interface to the `tree` and `history` subroutes
where they are needed.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-12 15:15:39 +02:00
xphoniex 08a5a329c3 Use correct tree hash for file path on diff page
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-07-12 14:43:50 +02:00
xphoniex 5db94a962d Show "Empty file" when diff is plain without hunks
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-07-12 14:16:54 +02:00
Thomas Scholtes 829532fe94 Decouple project route types from loaded types
We remove the requirement that `LoadedSourceBrowsingView` needs to be
assignable to `ProjectParams["view"]`. This decouples `ProjectRoute` and
`ProjectLoadedRoute` and lets us modify them independently.

I did not use a common `routeParamsView` function because I prefer the
flexibility of being able to modify them independently while this area
of code changes a lot.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-11 14:22:41 +02:00
Thomas Scholtes f09e3f6edf Remove redundant selectedCommit route property
Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-11 14:22:41 +02:00
Sebastian Martinez 9294e23ea4 Update patch review schemas
To address changes to patch code review,
implemented in Heartwood in commit 45e87a6.

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-07-11 13:59:23 +02:00
Thomas Scholtes bb5f6613e7 Improve resource separation in route URL building
We refactor the code that builds a URL from a project route so that it
is clearer that only the `tree` and `history` resource have some
complicated logic. We also eliminate the use of the shared `suffix`
variable. We now build the URL left-to-right.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-11 12:04:17 +02:00
Thomas Scholtes a7f267932d Stop handling URL hash through routing
We stop handling the URL hash through the routing system. Hashes are
local to the current view and can be handled by the shown components.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-10 15:15:22 +02:00
Rūdolfs Ošiņš 74fa05cf26 Rewrite markdown link navigation
Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
2023-07-09 15:17:43 +02:00
Rūdolfs Ošiņš cb52e96542 Use generic routing Link component everywhere
This way we can get rid of the project browsing specific ProjectLink
component and simplify the router types.

Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
2023-07-09 15:05:18 +02:00
Thomas Scholtes f3e5b47124 Don’t replace path on internal navigation
We don’t replace the path when we navigate internally. This means we
keep the hash part of the URL even if it is not part of the route and we
can remove the workaround for that.

This also means that we keep the original URL if the parsed route would
result in a different URL. This change is visible through a slight
adjustments in the tests.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-09 14:46:26 +02:00
Sebastian Martinez bde2d97c9b Update dependencies
We had to change the eventDispatcher for events that shouldn't have a
second parameter to `null` instead of `never`.

See: https://github.com/sveltejs/svelte/pull/8872

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-07-09 14:02:58 +02:00
Thomas Scholtes 2386b7c154 Move project route to path code into project router module
Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-09 13:34:11 +02:00
Thomas Scholtes 092f8ad774 Don’t leave line selected when switching blobs
Fixes #906

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-07 07:41:51 +02:00
Thomas Scholtes e0e659f54a Only log errors when something unexpected happens in local node connection
We remove a couple of calls to `console.error()` in the code for the
local node connection. It’s not necessary to log errors that are
expected, for example, if the node is down.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-06 10:14:34 +02:00
Thomas Scholtes d94b78a784 Simplify branch loading in project route
* Don’t load branches in `commits` view. We the branch selector is not
  enabled there.
* Don’t silently swallow errors when fetching branches. Let the route
  loading mechanism handle errors.
* Don’t use the default branch as the fallback for `branches`. They are
  allowed to be empty and the empty case is handled properly now.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-05 17:06:42 +02:00
Thomas Scholtes db778f97b1 Remove unnecessary logic in BranchSelector
We remove logic used in the `BranchSelector` component. Instead we
restructure the component properties and rely on the `Browser`,
`History` and `Commit` components to pass values that result in the same
behavior.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-07-05 17:06:39 +02:00
Rūdolfs Ošiņš 44e55415d4 Slim down Project header props
Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
2023-07-05 14:07:05 +02:00
Rūdolfs Ošiņš 70a876b65f Move SourceBrowsingHeader into the respective sub views
Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
2023-07-05 14:07:05 +02:00
Sebastian Martinez 91f5abafd3 Add a UI test flow for issues
Tests:
- Authentication
- Issue creation
- Title editing
- Commenting
- Reply to comment
- Issue state change

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-07-05 13:48:42 +02:00
Sebastian Martinez 8e7e94c896 Add padding to reviews without comment
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-07-04 16:52:18 +02:00
Sebastian Martinez 555d4da30c Fix some style regressions in patch view
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-07-04 16:33:17 +02:00
Rūdolfs Ošiņš 92f6d58dfc Use Link instead of ProjectLink in Issues/Patches/Commits
Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
2023-07-04 15:45:05 +02:00
Sebastian Martinez 33594b732f Change some ProjectLink components into Link
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-07-04 14:52:51 +02:00