Skip to content

Commit

Permalink
ScrapBox -> Scrapbox
Browse files Browse the repository at this point in the history
  • Loading branch information
nonylene committed Feb 8, 2024
1 parent 6b9b247 commit 32a1048
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion app/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default function Navbar() {
PukiWiki
</NavLink>
<NavLink to="/search/scrapbox" className="nav-item nav-link">
ScrapBox
Scrapbox
</NavLink>
<NavLink to="/search/mail" className="nav-item nav-link">
Mail
Expand Down
6 changes: 3 additions & 3 deletions app/routes/search.scrapbox/els-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function createPageResultFromResponse(json: any): PageResult {
};
}

export function buildScrapBoxSearch(
export function buildScrapboxSearch(
order: string,
page: number,
useRawQuery: boolean,
Expand All @@ -43,7 +43,7 @@ export function buildScrapBoxSearch(
};
}

interface ScrapBoxSearch {
interface ScrapboxSearch {
query: string;
size: number;
from: number;
Expand All @@ -55,7 +55,7 @@ export async function requestSearch({
size,
from,
order,
}: ScrapBoxSearch) {
}: ScrapboxSearch) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const queryJson: any = {
query: {
Expand Down
4 changes: 2 additions & 2 deletions app/routes/search.scrapbox/page-list.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Page, PageResult } from "./models";
import styles from "./page-list.css";
import { createScrapBoxUrl } from "./utils";
import { createScrapboxUrl } from "./utils";
import { faCalendar } from "@fortawesome/free-regular-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { LinksFunction } from "@remix-run/node";
Expand All @@ -20,7 +20,7 @@ function PageListItem(props: PageListItemProps) {
return (
<div className="row PageListItem mb-2">
<div className="col-md-10 offset-md-1">
<a href={createScrapBoxUrl(props.scrapboxBaseURL, props.page.title)}>
<a href={createScrapboxUrl(props.scrapboxBaseURL, props.page.title)}>
<h3>{props.page.title}</h3>
</a>
<p className="small mb-2">
Expand Down
8 changes: 4 additions & 4 deletions app/routes/search.scrapbox/route.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SEARCH_SIZE, buildScrapBoxSearch, requestSearch } from "./els-client";
import { SEARCH_SIZE, buildScrapboxSearch, requestSearch } from "./els-client";
import { PageResult } from "./models";
import { PageList, links as pageListLinks } from "./page-list";
import { SearchBox, links as searchBoxLinks } from "./search-box";
Expand Down Expand Up @@ -33,7 +33,7 @@ const sortOrderOptions = [

export const meta: MetaFunction = ({ location }) => {
const { query } = parseSearchParams(new URLSearchParams(location.search));
return [{ title: `${query ? `${query} - ` : ""}ScrapBox - Heineken` }];
return [{ title: `${query ? `${query} - ` : ""}Scrapbox - Heineken` }];
};

export const links: LinksFunction = () => [
Expand All @@ -47,7 +47,7 @@ export const loader = async ({ request }: LoaderFunctionArgs) => {
const { query, page, order, advanced } = parseSearchParams(searchParams);

// async 内で throw Response すると Errorboundary の Error がうまくとれないのでパースは non-async でやる
const search = buildScrapBoxSearch(order, page, advanced, query);
const search = buildScrapboxSearch(order, page, advanced, query);
const pageResult = requestSearch(search);

const scrapboxBaseURL = process.env.HEINEKEN_SCRAPBOX_BASE_URL!;
Expand Down Expand Up @@ -124,7 +124,7 @@ export function ErrorBoundary() {
);
}

export default function ScrapBox() {
export default function Scrapbox() {
const navigation = useNavigation();
// Susponse の fallback は search params の変化では起こらないので、
// ページ変更などのときは 自前で navigation.state を見る必要がある
Expand Down
2 changes: 1 addition & 1 deletion app/routes/search.scrapbox/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export function createScrapBoxUrl(baseUrl: string, title: string) {
export function createScrapboxUrl(baseUrl: string, title: string) {
const titleUrlEncoded = encodeURIComponent(title);
const url = new URL(titleUrlEncoded, baseUrl);
return url.toString();
Expand Down

0 comments on commit 32a1048

Please sign in to comment.