Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 1 addition & 4 deletions josh-ui/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div class="logo">
<img src="%PUBLIC_URL%/logo.png" alt="Josh logo"/>
<span>Josh</span>
<div id="root">
</div>
<div id="root"></div>
</body>
</html>
84 changes: 81 additions & 3 deletions josh-ui/src/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ $color-link: $color-font-normal;
$color-link-hover: #ffffaa;
$color-link-visited: $color-font-normal;
$color-link-visited-hover: #ffffaa;
$color-file-added: #123212;
$color-file-deleted: #321212;
$color-file-added-hover: #324232;
$color-file-deleted-hover: #423232;

@mixin ui-link-clickable {
color: $color-link;
Expand Down Expand Up @@ -40,7 +44,7 @@ body {
}

.file-browser-list {
margin: 0;
margin: 1.5em;

&-entry {
@include ui-link-clickable;
Expand All @@ -67,7 +71,7 @@ body {

nav {
&.breadcrumbs {
padding: .2em .5em;
padding: .2em 1.8em;
margin-bottom: 0.7em;
}

Expand All @@ -81,10 +85,17 @@ nav {
}
}

pre.commit-message {
padding: 2em;
font-family: $font-main;
background: #111111;
}

.logo {
img {
display: inline-block;
height: 40px;
padding: 0em 0.8em;
}

margin: .3em 0 .7em;
Expand All @@ -97,11 +108,31 @@ nav {
height: 1em;
}

a {
font-weight: bold;
color: $color-highlight;
text-transform: lowercase;
text-decoration: none;
}
}

.current-page {
margin: .3em 0 0.7em;
display: flex;
flex-direction: row;
padding-right: 1.5em;

span {
align-self: center;
font-size: 1.44em;
height: 1em;
font-weight: bold;
color: $color-font-shadowed;
text-decoration: none;
}

}


.now-browsing {
display: flex;
justify-content: space-between;
Expand Down Expand Up @@ -138,6 +169,21 @@ nav {
&:hover {
background: $color-background-highlight;
}

&.deleted {
background: $color-file-deleted;
&:hover {
background: $color-file-deleted-hover;
}
}

&.added {
background: $color-file-added;
&:hover {
background: $color-file-added-hover;
}
}

}

.commit-list-entry-dir {
Expand All @@ -161,6 +207,22 @@ nav {
}
}

.changes-list-entry .summary {
@include ui-link-clickable;
&:hover {
background: $color-background-highlight;
}
}

.changes-list-entry .hame {
display: block;
@include ui-link-clickable;
&:hover {
background: $color-background-highlight;
}
}


.commit-list-entry-browse {
@include ui-link-clickable;
&:hover {
Expand All @@ -182,16 +244,32 @@ nav {
color: $color-highlight;
font-weight: bolder;
}
span.name {
margin: 0 0.7em 0 0;
font-weight: bolder;
color: $color-font-shadowed;
}
span.authorEmail {
float: right;
margin: 0 0.7em 0 0;
color: $color-font-shadowed;
font-weight: bolder;
}
span.change-hash {
float: right;
margin: 0 0.7em 0 0;
font-weight: bolder;
}
span.summary {
margin: 0 0.7em 0 0;
font-weight: bolder;
}
span.change-summary {
color: $color-highlight;
display:block;
margin: 0 0.7em 0 0;
font-weight: bolder;
}
}

.ui-button {
Expand Down
57 changes: 38 additions & 19 deletions josh-ui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {FileViewer} from "./FileViewer";
import {DiffViewer} from "./DiffViewer";
import {ChangeViewer} from "./ChangeViewer";
import {HistoryList} from "./History";
import {ChangesList} from "./Changes";
import {Breadcrumbs} from "./Breadcrumbs";
import {DEFAULT_FILTER} from "./Josh";

Expand Down Expand Up @@ -108,24 +109,24 @@ function Select() {
</div>
}

function TopNav(props: { repo: string, filter: string }) {
function TopNav(props: { repo: string, filter: string, page: string }) {
const selectParams = {
repo: props.repo,
filter: props.filter,
}

return <div className={'now-browsing'}>
<span className={'now-browsing-name'}>
<span className={'now-browsing-name-repo'}>
now browsing: {props.repo}
</span>
{props.filter !== DEFAULT_FILTER && <span className={'now-browsing-name-filter'}>
{props.filter}
</span>}
</span>
<span className={'now-browsing-select'}>
<Link to={`/select?${createSearchParams(selectParams)}`}>select repo</Link>
</span>
<div className="logo">
<img src={process.env.PUBLIC_URL.concat("/logo.png")} alt="Josh logo"/>
<span className="now-browsing-name">
<Link to={`/select?${createSearchParams(selectParams)}`}>
{props.repo}{props.filter !== DEFAULT_FILTER && props.filter}
</Link>
</span>
</div>
<div className="current-page">
<span>{props.page}</span>
</div>
</div>
}

Expand All @@ -137,6 +138,7 @@ function Browse() {
return <div>
<TopNav
repo={param('repo')}
page={param('rev')}
filter={param('filter')} />

<Breadcrumbs
Expand Down Expand Up @@ -166,6 +168,7 @@ function ChangeView() {
return <div>
<TopNav
repo={param('repo')}
page="change"
filter={param('filter')} />

<ChangeViewer
Expand All @@ -185,6 +188,7 @@ function History() {
return <div>
<TopNav
repo={param('repo')}
page={param('rev')}
filter={param('filter')} />

<HistoryList
Expand All @@ -196,6 +200,25 @@ function History() {
</div>
}

function Changes() {
const param = useStrictGetSearchParam()

useTitleEffect(`Changes - ${param('repo')} - Josh`)

return <div>
<TopNav
repo={param('repo')}
page="changes"
filter={param('filter')} />

<ChangesList
repo={param('repo')}
filter={param('filter')}
navigateCallback={useNavigateCallback()}
/>
</div>
}


function View() {
const param = useStrictGetSearchParam()
Expand All @@ -206,6 +229,7 @@ function View() {
<div>
<TopNav
repo={param('repo')}
page="file"
filter={param('filter')} />

<Breadcrumbs
Expand Down Expand Up @@ -237,15 +261,9 @@ function DiffView() {
<div>
<TopNav
repo={param('repo')}
page="diff"
filter={param('filter')} />

<Breadcrumbs
repo={param('repo')}
path={param('path')}
filter={param('filter')}
rev={param('rev')}
navigateCallback={useNavigateCallback()} />

<DiffViewer
repo={param('repo')}
path={param('path')}
Expand All @@ -266,6 +284,7 @@ function App() {
<Route path='/select' element={<Select />} />
<Route path='/browse' element={<Browse />} />
<Route path='/history' element={<History />} />
<Route path='/changes' element={<Changes />} />
<Route path='/view' element={<View />} />
<Route path='/diff' element={<DiffView />} />
<Route path='/change' element={<ChangeView />} />
Expand Down
13 changes: 6 additions & 7 deletions josh-ui/src/ChangeViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,23 +82,22 @@ export class ChangeViewer extends React.Component<ChangeViewProps, State> {
}

return values.map((entry) => {
const className = `file-browser-list-entry file-browser-list-entry-${classNameSuffix}`
let className = `file-browser-list-entry file-browser-list-entry-${classNameSuffix}`
let path = "";
let prefix = "M";
if (!entry.from) {
prefix = "A";
className = className.concat(" added");
path = entry.to.path;
}
else if (!entry.to) {
prefix = "D";
className = className.concat(" deleted");
path = entry.from.path;
}
else {
path = entry.from.path;
}

return <div className={className} key={path} onClick={navigate.bind(this,path)}>
<span>{prefix}</span>{path}
{path}
</div>
})
}
Expand All @@ -108,9 +107,9 @@ export class ChangeViewer extends React.Component<ChangeViewProps, State> {
return <div className={'file-browser-loading'}>Loading...</div>
} else {
return <div>
<div>
<pre className="commit-message">
{this.state.summary}
</div>
</pre>
<div className={'file-browser-list'}>
{this.renderList(this.state.files, NavigateTargetType.Diff)}
</div>
Expand Down
Loading