Skip to content

Commit

Permalink
#236-update-url WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
joepio committed Oct 10, 2022
1 parent 1b4855f commit 43724d6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
11 changes: 9 additions & 2 deletions data-browser/src/components/SideBar/DriveSwitcher.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { classes, Resource, urls, useResources } from '@tomic/react';
import {
classes,
Resource,
truncateUrl,
urls,
useResources,
} from '@tomic/react';
import React, { useMemo } from 'react';
import {
FaCog,
Expand Down Expand Up @@ -26,7 +32,8 @@ const Trigger = buildDefaultTrigger(

function getTitle(resource: Resource): string {
return (
(resource.get(urls.properties.name) as string) ?? resource.getSubject()
(resource.get(urls.properties.name) as string) ??
truncateUrl(resource.getSubject(), 20)
);
}

Expand Down
3 changes: 2 additions & 1 deletion data-browser/src/routes/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import ResourcePage from '../views/ResourcePage';
import { ShareRoute } from './ShareRoute';
import { Sandbox } from './Sandbox';

const homeURL = window.location.origin;
/** Server URLs should have a `/` at the end */
const homeURL = window.location.origin + '/';

const isDev = import.meta.env.MODE === 'development';

Expand Down
5 changes: 3 additions & 2 deletions data-browser/src/routes/SearchRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ export function Search(): JSX.Element {

return (
<ContainerNarrow ref={htmlElRef}>
{error && <ErrorLook>{error.message}</ErrorLook>}
{query?.length !== 0 && results.length !== 0 ? (
{error ? (
<ErrorLook>{error.message}</ErrorLook>
) : query?.length !== 0 && results.length !== 0 ? (
<>
{results.map((subject, index) => (
<ResourceCard
Expand Down
1 change: 1 addition & 0 deletions lib/src/authentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export async function signRequest(
agent: Agent,
headers: HeadersObject | Headers,
): Promise<HeadersObject> {
console.log('sign request', subject);
const timestamp = getTimestampNow();

if (agent?.subject && !localTryingExternal(subject, agent)) {
Expand Down

0 comments on commit 43724d6

Please sign in to comment.