Skip to content

Commit

Permalink
docs(demo): Use @/ import prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
ntucker committed Sep 27, 2024
1 parent 1b498c3 commit e005dd3
Show file tree
Hide file tree
Showing 22 changed files with 77 additions and 50 deletions.
8 changes: 5 additions & 3 deletions examples/github-app/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { memo } from 'react';
import { MatchedRoute } from '@anansi/router';
import { Layout } from 'antd';
import Boundary from 'Boundary';
import { memo } from 'react';

import Boundary from '@/Boundary';
import NavBar from '@/navigation/NavBar';

import 'antd/dist/reset.css';
import 'style/main.css';
import NavBar from 'navigation/NavBar';

const { Content } = Layout;

Expand Down
5 changes: 3 additions & 2 deletions examples/github-app/src/RootProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import {
getDefaultManagers,
ProviderProps,
} from '@data-client/react';
import { AuthdProvider } from 'navigation/authdContext';
import type { ReactNode } from 'react';
import { ErrorBoundary } from 'react-error-boundary';
import type { FallbackProps } from 'react-error-boundary';
import { unAuth } from 'resources/Auth';

import { AuthdProvider } from '@/navigation/authdContext';
import { unAuth } from '@/resources/Auth';

import Boundary from './Boundary';
import { Router } from './routing';
Expand Down
3 changes: 2 additions & 1 deletion examples/github-app/src/components/Labels.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Tag, Space } from 'antd';
import { memo } from 'react';
import type { Label } from 'resources/Label';

import type { Label } from '@/resources/Label';

function Labels({ labels }: { labels: Label[] }) {
return (
Expand Down
3 changes: 2 additions & 1 deletion examples/github-app/src/navigation/NavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { AsyncBoundary, useCache, useSuspense } from '@data-client/react';
import { Layout, Menu, Spin, Affix, MenuProps } from 'antd';
import { Avatar } from 'antd';
import { memo, useContext, useMemo, useState } from 'react';
import UserResource from 'resources/User';

import UserResource from '@/resources/User';

import { authdContext } from './authdContext';
import LoginModal from './LoginModal';
Expand Down
5 changes: 3 additions & 2 deletions examples/github-app/src/navigation/authdContext.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { useController } from '@data-client/react';
import React, { createContext, useCallback, useMemo } from 'react';
import { setAuth, unAuth } from 'resources/Auth';
import UserResource from 'resources/User';

import { setAuth, unAuth } from '@/resources/Auth';
import UserResource from '@/resources/User';

export const authdContext = createContext({
login(data: { login: string; token: string }): void {
Expand Down
7 changes: 4 additions & 3 deletions examples/github-app/src/pages/IssueDetail/CommentInline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import { useCache, useController } from '@data-client/react';
import { Intl } from '@js-temporal/polyfill';
import { css } from '@linaria/core';
import { Card, Avatar, Button, Tag, Popover } from 'antd';
import FlexRow from 'components/FlexRow';
import React, { memo, useCallback, useState } from 'react';
import Markdown from 'react-markdown';
import rehypeHighlight from 'rehype-highlight';
import remarkGfm from 'remark-gfm';
import remarkRemoveComments from 'remark-remove-comments';
import { CommentResource, Comment } from 'resources/Comment';
import { UserResource } from 'resources/User';

import FlexRow from '@/components/FlexRow';
import { CommentResource, Comment } from '@/resources/Comment';
import { UserResource } from '@/resources/User';

import CommentForm from './CommentForm';

Expand Down
3 changes: 2 additions & 1 deletion examples/github-app/src/pages/IssueDetail/CommentsList.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useSuspense } from '@data-client/react';
import { Card } from 'antd';
import { CommentResource } from 'resources/Comment';

import { CommentResource } from '@/resources/Comment';

import CommentInline from './CommentInline';

Expand Down
7 changes: 4 additions & 3 deletions examples/github-app/src/pages/IssueDetail/CreateComment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import { useCache, useController } from '@data-client/react';
import { css } from '@linaria/core';
import { Card, Avatar } from 'antd';
import { memo, useCallback } from 'react';
import { CommentResource } from 'resources/Comment';
import { Issue } from 'resources/Issue';
import UserResource from 'resources/User';

import { CommentResource } from '@/resources/Comment';
import { Issue } from '@/resources/Issue';
import UserResource from '@/resources/User';

import CommentForm from './CommentForm';

Expand Down
11 changes: 8 additions & 3 deletions examples/github-app/src/pages/IssueDetail/CreateReaction.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import { useController, useCache } from '@data-client/react';
import { Tag } from 'antd';
import { Issue } from 'resources/Issue';
import { Reaction, ReactionResource, contentToIcon } from 'resources/Reaction';
import { UserResource } from 'resources/User';
import { v4 as uuid } from 'uuid';

import { Issue } from '@/resources/Issue';
import {
Reaction,
ReactionResource,
contentToIcon,
} from '@/resources/Reaction';
import { UserResource } from '@/resources/User';

const { CheckableTag } = Tag;

export function CreateReaction({ content, reactions = [], issue }: Props) {
Expand Down
7 changes: 4 additions & 3 deletions examples/github-app/src/pages/IssueDetail/ReactionSpan.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { useController, useCache } from '@data-client/react';
import { Tag } from 'antd';
import React, { useCallback } from 'react';
import { Issue } from 'resources/Issue';
import { Reaction, ReactionResource } from 'resources/Reaction';
import { UserResource } from 'resources/User';
import { v4 as uuid } from 'uuid';

import { Issue } from '@/resources/Issue';
import { Reaction, ReactionResource } from '@/resources/Reaction';
import { UserResource } from '@/resources/User';

const { CheckableTag } = Tag;

export function ReactionSpan({
Expand Down
11 changes: 6 additions & 5 deletions examples/github-app/src/pages/IssueDetail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@ import { Link } from '@anansi/router';
import { useSuspense, useCache, useDLE } from '@data-client/react';
import { Card, Avatar } from 'antd';
import { Tag } from 'antd';
import Boundary from 'Boundary';
import FlexRow from 'components/FlexRow';
import React, { useMemo, memo } from 'react';
import { ErrorBoundary } from 'react-error-boundary';
import Markdown from 'react-markdown';
import rehypeHighlight from 'rehype-highlight';
import remarkGfm from 'remark-gfm';
import remarkRemoveComments from 'remark-remove-comments';
import { IssueResource } from 'resources/Issue';
import { ReactionResource } from 'resources/Reaction';
import UserResource from 'resources/User';

import Boundary from '@/Boundary';
import FlexRow from '@/components/FlexRow';
import { IssueResource } from '@/resources/Issue';
import { ReactionResource } from '@/resources/Reaction';
import UserResource from '@/resources/User';

import CommentsList, { CardLoading } from './CommentsList';
import CreateComment from './CreateComment';
Expand Down
7 changes: 4 additions & 3 deletions examples/github-app/src/pages/IssueDetail/issueActions.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Popover } from 'antd';
import Labels from 'components/Labels';
import { groupBy } from 'lodash';
import React from 'react';
import { type Issue } from 'resources/Issue';
import { contentToIcon, type Reaction } from 'resources/Reaction';

import Labels from '@/components/Labels';
import { type Issue } from '@/resources/Issue';
import { contentToIcon, type Reaction } from '@/resources/Reaction';

import { CreateReaction } from './CreateReaction';
import { ReactionSpan } from './ReactionSpan';
Expand Down
3 changes: 2 additions & 1 deletion examples/github-app/src/pages/IssueList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { useSuspense } from '@data-client/react';
import { List } from 'antd';
import parseLink from 'parse-link-header';
import { memo } from 'react';
import { Issue, IssueResource } from 'resources/Issue';

import { Issue, IssueResource } from '@/resources/Issue';

import IssueListItem from './IssueListItem';
import NextPage from './NextPage';
Expand Down
7 changes: 4 additions & 3 deletions examples/github-app/src/pages/IssueListItem.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Link } from '@anansi/router';
import { List, Avatar, Skeleton } from 'antd';
import { humanTime } from 'components/human';
import Labels from 'components/Labels';
import { memo } from 'react';
import { Issue } from 'resources/Issue';

import { humanTime } from '@/components/human';
import Labels from '@/components/Labels';
import { Issue } from '@/resources/Issue';

function IssueListItem({ issue }: { issue: Issue }) {
const actions = [];
Expand Down
3 changes: 2 additions & 1 deletion examples/github-app/src/pages/IssuesPage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Link, useLocationSearch } from '@anansi/router';
import { HomeOutlined } from '@ant-design/icons';
import { Breadcrumb } from 'antd';
import { Issue } from 'resources/Issue';

import { Issue } from '@/resources/Issue';

import IssueList from './IssueList';

Expand Down
3 changes: 2 additions & 1 deletion examples/github-app/src/pages/NextPage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useController, useLoading } from '@data-client/react';
import { Button } from 'antd';
import { IssueResource } from 'resources/Issue';

import { IssueResource } from '@/resources/Issue';

export default function NextPage({ q, page }: Props) {
const ctrl = useController();
Expand Down
5 changes: 3 additions & 2 deletions examples/github-app/src/pages/ProfileDetail/UserEvents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Intl } from '@js-temporal/polyfill';
import { Timeline, Typography, Divider } from 'antd';
import { groupBy } from 'lodash';
import { useMemo } from 'react';

import {
EventResource,
typeToIcon,
Expand All @@ -13,8 +14,8 @@ import {
IssuesEvent,
PushEvent,
PullRequestReviewEvent,
} from 'resources/Event';
import { User } from 'resources/User';
} from '@/resources/Event';
import { User } from '@/resources/User';

import FlexRow from '../../components/FlexRow';

Expand Down
5 changes: 3 additions & 2 deletions examples/github-app/src/pages/ProfileDetail/UserRepos.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import { ForkOutlined, StarOutlined } from '@ant-design/icons';
import { useCache, useSuspense } from '@data-client/react';
import { List, Space, Typography } from 'antd';
import React from 'react';
import RepositoryResource, { Repository } from 'resources/Repository';
import { UserResource, User } from 'resources/User';

import RepositoryResource, { Repository } from '@/resources/Repository';
import { UserResource, User } from '@/resources/User';

const { Title } = Typography;

Expand Down
3 changes: 2 additions & 1 deletion examples/github-app/src/pages/ProfileDetail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { useSuspense } from '@data-client/react';
import { Intl } from '@js-temporal/polyfill';
import { Card, List, Layout, Typography } from 'antd';
import Markdown from 'react-markdown';
import { UserResource } from 'resources/User';

import { UserResource } from '@/resources/User';

import UserEvents from './UserEvents';
import UserRepositories from './UserRepos';
Expand Down
3 changes: 2 additions & 1 deletion examples/github-app/src/pages/PullsPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useLocationSearch } from '@anansi/router';
import { Issue } from 'resources/Issue';

import { Issue } from '@/resources/Issue';

import IssueList from './IssueList';

Expand Down
13 changes: 7 additions & 6 deletions examples/github-app/src/routing/routes.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { getImage } from '@data-client/img';
import { Controller } from '@data-client/react';
import CommentResource from 'resources/Comment';
import { EventResource } from 'resources/Event';
import IssueResource from 'resources/Issue';
import ReactionResource from 'resources/Reaction';
import RepositoryResource from 'resources/Repository';
import UserResource from 'resources/User';

import CommentResource from '@/resources/Comment';
import { EventResource } from '@/resources/Event';
import IssueResource from '@/resources/Issue';
import ReactionResource from '@/resources/Reaction';
import RepositoryResource from '@/resources/Repository';
import UserResource from '@/resources/User';

import { lazyPage } from './lazyPage';

Expand Down
5 changes: 3 additions & 2 deletions examples/github-app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"outDir": "./dist",
"baseUrl": "./src",
"baseUrl": "./",
"target": "esnext",
"module": "esnext",
"lib": ["dom", "esnext"],
Expand All @@ -17,7 +17,8 @@

"types": ["@anansi/webpack-config/types","./src/types/remark-remove-comments"],
"paths": {
"resources/*": ["resources/*"]
"@/*": ["./src/*"],
"@/resources/*": ["./src/resources/*"]
},
"noEmit": true
},
Expand Down

0 comments on commit e005dd3

Please sign in to comment.