Skip to content

Commit 51651c6

Browse files
chore: optimize PWA imports
1 parent cc8e8ea commit 51651c6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+197
-215
lines changed

pwa/app/auth.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
import { type TokenSet } from "@auth/core/types";
2-
import NextAuth, { type Session as DefaultSession, type User } from "next-auth";
1+
import {type TokenSet} from "@auth/core/types";
2+
import NextAuth, {type Session as DefaultSession, type User} from "next-auth";
33
import KeycloakProvider from "next-auth/providers/keycloak";
44

5-
import { NEXT_PUBLIC_OIDC_CLIENT_ID, NEXT_PUBLIC_OIDC_SERVER_URL, NEXT_PUBLIC_OIDC_SERVER_URL_INTERNAL } from "../config/keycloak";
5+
import {
6+
NEXT_PUBLIC_OIDC_CLIENT_ID,
7+
NEXT_PUBLIC_OIDC_SERVER_URL,
8+
NEXT_PUBLIC_OIDC_SERVER_URL_INTERNAL
9+
} from "../config/keycloak";
610

711
export interface Session extends DefaultSession {
812
error?: "RefreshAccessTokenError"

pwa/app/bookmarks/page.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { type Metadata } from "next";
2-
import { redirect } from "next/navigation";
3-
4-
import { List, type Props as ListProps } from "../../components/bookmark/List";
5-
import { type Bookmark } from "../../types/Bookmark";
6-
import { type PagedCollection } from "../../types/collection";
7-
import { type FetchResponse, fetchApi } from "../../utils/dataAccess";
8-
import { type Session, auth } from "../auth";
1+
import {type Metadata} from "next";
2+
import {redirect} from "next/navigation";
3+
4+
import {List, type Props as ListProps} from "../../components/bookmark/List";
5+
import {type Bookmark} from "../../types/Bookmark";
6+
import {type PagedCollection} from "../../types/collection";
7+
import {fetchApi, type FetchResponse} from "../../utils/dataAccess";
8+
import {auth, type Session} from "../auth";
99

1010
interface Query extends URLSearchParams {
1111
page?: number|string|null;

pwa/app/books/[id]/[slug]/page.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { type Metadata } from "next";
2-
import { notFound } from "next/navigation";
1+
import {type Metadata} from "next";
2+
import {notFound} from "next/navigation";
33

4-
import { Show, type Props as ShowProps } from "../../../../components/book/Show";
5-
import { Book } from "../../../../types/Book";
6-
import { type FetchResponse, fetchApi } from "../../../../utils/dataAccess";
7-
import { type Session, auth } from "../../../auth";
4+
import {type Props as ShowProps, Show} from "../../../../components/book/Show";
5+
import {Book} from "../../../../types/Book";
6+
import {fetchApi, type FetchResponse} from "../../../../utils/dataAccess";
7+
import {auth, type Session} from "../../../auth";
88

99
interface Props {
1010
params: { id: string };

pwa/app/books/page.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { type Metadata } from "next";
1+
import {type Metadata} from "next";
22

33
import {auth, type Session} from "../auth";
4-
import { List, type Props as ListProps } from "../../components/book/List";
5-
import { type Book } from "../../types/Book";
6-
import { type PagedCollection } from "../../types/collection";
7-
import { type FetchResponse, fetchApi } from "../../utils/dataAccess";
8-
import { type FiltersProps, buildUriFromFilters } from "../../utils/book";
4+
import {List, type Props as ListProps} from "../../components/book/List";
5+
import {type Book} from "../../types/Book";
6+
import {type PagedCollection} from "../../types/collection";
7+
import {fetchApi, type FetchResponse} from "../../utils/dataAccess";
8+
import {buildUriFromFilters, type FiltersProps} from "../../utils/book";
99

1010
interface Query extends URLSearchParams {
1111
page?: number|string|undefined;

pwa/app/layout.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import type { Metadata } from "next";
2-
import { type ReactNode } from "react";
3-
import { SessionProvider } from "next-auth/react";
1+
import type {Metadata} from "next";
2+
import {type ReactNode} from "react";
3+
import {SessionProvider} from "next-auth/react";
44
import "@fontsource/poppins";
55
import "@fontsource/poppins/600.css";
66
import "@fontsource/poppins/700.css";
77

8-
import { Layout } from "../components/common/Layout";
8+
import {Layout} from "../components/common/Layout";
99
import "../styles/globals.css";
10-
import { Providers } from "./providers";
11-
import { auth } from "./auth";
10+
import {Providers} from "./providers";
11+
import {auth} from "./auth";
1212

1313
export const metadata: Metadata = {
1414
title: 'Welcome to API Platform!',

pwa/app/providers.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"use client";
22

3-
import { type ReactNode, useState } from "react";
4-
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
5-
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
6-
import { ReactQueryStreamedHydration } from "@tanstack/react-query-next-experimental";
3+
import {type ReactNode, useState} from "react";
4+
import {QueryClient, QueryClientProvider} from "@tanstack/react-query";
5+
import {ReactQueryDevtools} from "@tanstack/react-query-devtools";
6+
import {ReactQueryStreamedHydration} from "@tanstack/react-query-next-experimental";
77

88
export function Providers(props: { children: ReactNode }) {
99
const [queryClient] = useState(

pwa/components/admin/Admin.tsx

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
11
"use client";
22

33
import Head from "next/head";
4-
import { useContext, useRef, useState } from "react";
5-
import { type DataProvider, localStorageStore } from "react-admin";
6-
import { signIn, useSession } from "next-auth/react";
4+
import {useContext, useRef, useState} from "react";
5+
import {type DataProvider, localStorageStore} from "react-admin";
6+
import {signIn, useSession} from "next-auth/react";
77
import SyncLoader from "react-spinners/SyncLoader";
8-
import {
9-
fetchHydra,
10-
HydraAdmin,
11-
hydraDataProvider,
12-
OpenApiAdmin,
13-
ResourceGuesser,
14-
} from "@api-platform/admin";
15-
import { parseHydraDocumentation } from "@api-platform/api-doc-parser";
16-
17-
import { type Session } from "../../app/auth";
8+
import {fetchHydra, HydraAdmin, hydraDataProvider, OpenApiAdmin, ResourceGuesser,} from "@api-platform/admin";
9+
import {parseHydraDocumentation} from "@api-platform/api-doc-parser";
10+
11+
import {type Session} from "../../app/auth";
1812
import DocContext from "../../components/admin/DocContext";
1913
import authProvider from "../../components/admin/authProvider";
2014
import Layout from "./layout/Layout";
21-
import { ENTRYPOINT } from "../../config/entrypoint";
15+
import {ENTRYPOINT} from "../../config/entrypoint";
2216
import bookResourceProps from "./book";
2317
import reviewResourceProps from "./review";
2418
import i18nProvider from "./i18nProvider";

pwa/components/admin/DocContext.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createContext } from "react";
1+
import {createContext} from "react";
22

33
const DocContext = createContext({
44
docType: "hydra",

pwa/components/admin/authProvider.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { AuthProvider } from "react-admin";
2-
import { getSession, signIn, signOut } from "next-auth/react";
1+
import {AuthProvider} from "react-admin";
2+
import {getSession, signIn, signOut} from "next-auth/react";
33

4-
import { NEXT_PUBLIC_OIDC_SERVER_URL } from "../../config/keycloak";
4+
import {NEXT_PUBLIC_OIDC_SERVER_URL} from "../../config/keycloak";
55

66
const authProvider: AuthProvider = {
77
// Nothing to do here, this function will never be called

pwa/components/admin/book/BookForm.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { required } from "react-admin";
1+
import {required} from "react-admin";
22

3-
import { ConditionInput } from "./ConditionInput";
4-
import { BookInput } from "./BookInput";
3+
import {ConditionInput} from "./ConditionInput";
4+
import {BookInput} from "./BookInput";
55

66
export const BookForm = () => (
77
<>

0 commit comments

Comments
 (0)