Skip to content
This repository was archived by the owner on Aug 1, 2022. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
02c2321
starting the process
sarahscott Oct 1, 2020
2c29219
revision & peer selectors
sarahscott Oct 2, 2020
717904f
move logic into project
sarahscott Oct 2, 2020
99f3914
cleanup
sarahscott Oct 5, 2020
0f5ab2a
fix source browsing tests
sarahscott Oct 5, 2020
c0591be
Merge branch 'master' into sos/typing-source-browsing
sarahscott Oct 5, 2020
47f23ac
more comments
sarahscott Oct 6, 2020
127b11d
fix peer selector
sarahscott Oct 6, 2020
4638cb8
actually fix tests
sarahscott Oct 6, 2020
09af3dd
Merge branch 'master' into sos/typing-source-browsing
sarahscott Oct 6, 2020
43e02d6
Merge branch 'master' into sos/typing-source-browsing
sarahscott Oct 7, 2020
2bc22ea
feeedback
sarahscott Oct 7, 2020
75ee113
Merge branch 'master' into sos/typing-source-browsing
sarahscott Oct 8, 2020
9f6feb9
Merge branch 'sos/typing-source-browsing' of https://github.com/radic…
sarahscott Oct 8, 2020
bba338f
Merge branch 'master' into sos/typing-source-browsing
xla Oct 18, 2020
5130537
Fix checkout
xla Oct 18, 2020
e6b6a7c
Fix exisitng project name validation
xla Oct 18, 2020
dd7c9c3
Add missing return types
xla Oct 18, 2020
93ce2dd
Merge branch 'master' into sos/typing-source-browsing
rudolfs Oct 20, 2020
f315aff
Fix imports
rudolfs Oct 20, 2020
6940504
Merge branch 'master' into sos/typing-source-browsing
rudolfs Oct 20, 2020
c4b7ab6
Remove Placeholder component
rudolfs Oct 20, 2020
d1f5857
Remove superfluous prop
rudolfs Oct 20, 2020
ae8d783
Fix last svelte-check complaint
rudolfs Oct 20, 2020
bdd6375
Fix exception when switching between projects
rudolfs Oct 20, 2020
8891740
Merge branch 'master' into sos/typing-source-browsing
rudolfs Oct 20, 2020
e62417f
Merge branch 'master' into sos/typing-source-browsing
rudolfs Oct 22, 2020
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
12 changes: 12 additions & 0 deletions cypress/integration/project_source_browsing.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,9 @@ context("source code browsing", () => {
});

it("allows navigating the tree structure", () => {
// Ensure the file has loaded before navigating away.
cy.pick("file-source").contains("README.md");

cy.pick("source-tree").within(() => {
// Traverse deeply nested folders.
cy.pick("expand-this").click();
Expand All @@ -342,6 +345,9 @@ context("source code browsing", () => {
});

it("highlights the selected file", () => {
// Ensure the file has loaded before navigating away.
cy.pick("file-source").contains("README.md");

cy.pick("source-tree").within(() => {
cy.contains(".i-am-well-hidden").should("not.have.class", "active");
cy.contains(".i-am-well-hidden").click();
Expand All @@ -352,6 +358,9 @@ context("source code browsing", () => {
context("when clicking on a file name", () => {
context("for non-binary files", () => {
it("shows the contents of the file", () => {
// Ensure the file has loaded before navigating away.
cy.pick("file-source").contains("README.md");

cy.pick("source-tree").within(() => {
cy.pick("expand-src").click();
cy.contains("Eval.hs").click();
Expand All @@ -374,6 +383,9 @@ context("source code browsing", () => {

context("for binary files", () => {
it("does not render the binary content", () => {
// Ensure the file has loaded before navigating away.
cy.pick("file-source").contains("README.md");

cy.pick("source-tree").within(() => {
cy.pick("expand-bin").click();
cy.contains("ls").click();
Expand Down
2 changes: 1 addition & 1 deletion ui/DesignSystem/Component/HorizontalMenu.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
title: string;
href: string;
looseActiveStateMatching: boolean;
counter?: string;
counter?: string | number;
}[];
</script>

Expand Down
2 changes: 1 addition & 1 deletion ui/DesignSystem/Component/HorizontalMenu/MenuItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
export let icon: typeof SvelteComponent;
export let title: string;
export let active: boolean;
export let counter: string | undefined;
export let counter: string | number | undefined = undefined;
</script>

<style>
Expand Down
73 changes: 22 additions & 51 deletions ui/DesignSystem/Component/SourceBrowser/RevisionSelector.svelte
Original file line number Diff line number Diff line change
@@ -1,48 +1,26 @@
<script>
import { getContext } from "svelte";
<script lang="ts">
import { createEventDispatcher } from "svelte";

import { isExperimental } from "../../../../native/ipc.js";
import { RevisionType } from "../../../src/source.ts";

import * as source from "../../../src/source";

import Overlay from "../Overlay.svelte";
import { Icon } from "../../Primitive";

export let currentRevision = null;
export let currentPeerId = null;
export let expanded = false;
export let revisions = null;

let currentSelectedPeer;

const { metadata } = getContext("project");

$: if (currentPeerId) {
currentSelectedPeer = revisions.find(rev => {
return rev.identity.peerId === currentPeerId;
});
} else {
// The API returns a revision list where the first entry is the default
// peer.
currentSelectedPeer = revisions[0];
}

// initialize currentRevision
$: if (!currentRevision) {
currentRevision = {
type: RevisionType.Branch,
name: metadata.defaultBranch,
peerId: currentSelectedPeer ? currentSelectedPeer.identity.peerId : "",
};
}
export let revisions: source.PeerRevisions;
export let currentRevision: source.Branch | source.Tag;

let expanded: boolean = false;
const toggle = () => (expanded = !expanded);

const hideDropdown = () => {
expanded = false;
};

const selectRevision = revision => {
currentRevision = revision;
const dispatch = createEventDispatcher();

const selectRevision = (revision: source.Branch | source.Tag) => {
dispatch("select", { revision });
hideDropdown();
};
</script>
Expand Down Expand Up @@ -126,7 +104,7 @@
hidden={expanded}>
<div class="selector-avatar typo-overflow-ellipsis">
<div style="display: flex; overflow: hidden;">
{#if currentRevision.type === RevisionType.Branch}
{#if currentRevision.type === source.RevisionType.Branch}
<Icon.Branch
dataCy="branch-icon"
style="vertical-align: bottom; fill: var(--color-foreground-level-4);
Expand All @@ -150,38 +128,31 @@
<div class="revision-dropdown-container">
<div class="revision-dropdown" hidden={!expanded}>
<ul>
{#each currentSelectedPeer.branches as branch}
{#each revisions.branches as branch}
<li
class="branch"
class:selected={currentRevision.name === branch && currentSelectedPeer.identity.peerId === currentSelectedPeer.identity.peerId}
data-branch={branch}
on:click|stopPropagation={() => selectRevision({
type: RevisionType.Branch,
peerId: currentSelectedPeer.identity.peerId,
name: branch,
})}>
class:selected={currentRevision.name === branch.name && currentRevision.peerId === branch.peerId}
data-branch={branch.name}
on:click={() => selectRevision(branch)}>
<Icon.Branch
dataCy="branch-icon"
style="vertical-align: bottom; fill:
var(--color-foreground-level-4)" />
<span class="revision-name typo-text">{branch}</span>
<span class="revision-name typo-text">{branch.name}</span>
</li>
{/each}
{#if isExperimental()}
{#each currentSelectedPeer.tags as tag}
{#each revisions.tags as tag}
<li
class="tag"
class:selected={currentRevision.name === tag && currentSelectedPeer.identity.peerId === currentSelectedPeer.identity.peerId}
data-tag={tag}
on:click|stopPropagation={() => selectRevision({
type: RevisionType.Tag,
name: tag,
})}>
class:selected={currentRevision.name === tag.name && currentRevision.peerId === tag.peerId}
data-tag={tag.name}
on:click={() => selectRevision(tag)}>
<Icon.Label
dataCy="tag-icon"
style="vertical-align: bottom; fill:
var(--color-foreground-level-4)" />
<span class="revision-name typo-text">{tag}</span>
<span class="revision-name typo-text">{tag.name}</span>
</li>
{/each}
{/if}
Expand Down
1 change: 0 additions & 1 deletion ui/Modal/SearchModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import { Remote, TrackToggle, Urn } from "../DesignSystem/Component";

import * as path from "../src/path";
import * as remote from "../src/remote";

import { request, updateUrn, validation } from "../src/search";
import { ValidationStatus } from "../src/validation";
Expand Down
Loading