Setup for unauthenticated doc viewing
This commit is contained in:
@@ -4,7 +4,6 @@ import { Provider } from 'mobx-react';
|
||||
import stores from 'stores';
|
||||
import ApiKeysStore from 'stores/ApiKeysStore';
|
||||
import UsersStore from 'stores/UsersStore';
|
||||
import DocumentsStore from 'stores/DocumentsStore';
|
||||
import CollectionsStore from 'stores/CollectionsStore';
|
||||
import IntegrationsStore from 'stores/IntegrationsStore';
|
||||
import CacheStore from 'stores/CacheStore';
|
||||
@@ -27,10 +26,6 @@ const Auth = ({ children }: Props) => {
|
||||
integrations: new IntegrationsStore(),
|
||||
apiKeys: new ApiKeysStore(),
|
||||
users: new UsersStore(),
|
||||
documents: new DocumentsStore({
|
||||
ui: stores.ui,
|
||||
cache,
|
||||
}),
|
||||
collections: new CollectionsStore({
|
||||
ui: stores.ui,
|
||||
teamId: team.id,
|
||||
|
||||
@@ -112,7 +112,14 @@ class DocumentPreview extends React.Component<Props> {
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
<DocumentLink to={document.url} innerRef={innerRef} {...rest}>
|
||||
<DocumentLink
|
||||
to={{
|
||||
pathname: document.url,
|
||||
state: { title: document.title },
|
||||
}}
|
||||
innerRef={innerRef}
|
||||
{...rest}
|
||||
>
|
||||
<Heading>
|
||||
<Highlight text={document.title} highlight={highlight} />
|
||||
{document.publishedAt && (
|
||||
|
||||
@@ -60,7 +60,10 @@ class DocumentLink extends React.Component<Props> {
|
||||
activeClassName="activeDropZone"
|
||||
>
|
||||
<SidebarLink
|
||||
to={document.url}
|
||||
to={{
|
||||
pathname: document.url,
|
||||
state: { title: document.title },
|
||||
}}
|
||||
expand={showChildren}
|
||||
expandedContent={
|
||||
document.children.length ? (
|
||||
|
||||
@@ -46,7 +46,7 @@ const StyledNavLink = styled(NavLink)`
|
||||
const StyledDiv = StyledNavLink.withComponent('div');
|
||||
|
||||
type Props = {
|
||||
to?: string,
|
||||
to?: string | Object,
|
||||
onClick?: (SyntheticEvent<*>) => *,
|
||||
children?: React.Node,
|
||||
icon?: React.Node,
|
||||
@@ -59,7 +59,6 @@ type Props = {
|
||||
active?: boolean,
|
||||
};
|
||||
|
||||
@withRouter
|
||||
@observer
|
||||
class SidebarLink extends React.Component<Props> {
|
||||
@observable expanded: boolean = false;
|
||||
@@ -158,4 +157,4 @@ const Content = styled.div`
|
||||
width: 100%;
|
||||
`;
|
||||
|
||||
export default SidebarLink;
|
||||
export default withRouter(SidebarLink);
|
||||
|
||||
Reference in New Issue
Block a user