From d47792f93094ab1ec31a5954dfdf6e83ebed09da Mon Sep 17 00:00:00 2001 From: Adrien KISSIE Date: Thu, 21 Dec 2023 06:40:41 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=9A=20move=20actions=20into=20*.action?= =?UTF-8?q?=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/(actions)/{auth.ts => auth.action.ts} | 0 src/app/(actions)/{github.ts => github.action.ts} | 0 src/app/(actions)/{issue.tsx => issue.action.tsx} | 2 +- src/app/(actions)/middlewares.ts | 2 +- src/app/(actions)/{theme.ts => theme.action.ts} | 2 +- src/app/(actions)/{user.ts => user.action.ts} | 0 src/app/(components)/header/index.tsx | 2 +- src/app/(components)/icon-switcher.tsx | 2 +- src/app/(components)/issues/issue-list.tsx | 6 +++--- .../(components)/issues/use-issue-assignee-list-query.ts | 2 +- .../issues/use-issue-author-list-by-name-query.ts | 2 +- src/app/(components)/issues/use-issue-author-list-query.ts | 2 +- src/app/(components)/issues/use-issue-label-list-query.ts | 2 +- src/app/(components)/theme-form.tsx | 4 ++-- src/app/(components)/toast/toaster.server.tsx | 2 +- src/app/(components)/update-user-infos-form.tsx | 2 +- src/app/(components)/user-dropdown/user-dropdown.client.tsx | 2 +- src/app/(components)/user-dropdown/user-dropdown.server.tsx | 2 +- src/app/(routes)/(app)/[user]/[repository]/issues/page.tsx | 2 +- src/app/(routes)/(app)/[user]/[repository]/page.tsx | 4 ++-- .../(routes)/(app)/[user]/[repository]/stargazers/page.tsx | 3 ++- src/app/(routes)/(app)/settings/account/page.tsx | 5 ++++- src/app/(routes)/(app)/settings/appearance/page.tsx | 4 ++-- src/app/(routes)/(app)/settings/layout.tsx | 5 ++++- src/app/(routes)/(app)/settings/page.tsx | 2 +- src/app/(routes)/api/auth/callback/route.ts | 2 +- src/app/(routes)/login/page.tsx | 4 +++- src/app/layout.tsx | 2 +- 28 files changed, 39 insertions(+), 30 deletions(-) rename src/app/(actions)/{auth.ts => auth.action.ts} (100%) rename src/app/(actions)/{github.ts => github.action.ts} (100%) rename src/app/(actions)/{issue.tsx => issue.action.tsx} (98%) rename src/app/(actions)/{theme.ts => theme.action.ts} (97%) rename src/app/(actions)/{user.ts => user.action.ts} (100%) diff --git a/src/app/(actions)/auth.ts b/src/app/(actions)/auth.action.ts similarity index 100% rename from src/app/(actions)/auth.ts rename to src/app/(actions)/auth.action.ts diff --git a/src/app/(actions)/github.ts b/src/app/(actions)/github.action.ts similarity index 100% rename from src/app/(actions)/github.ts rename to src/app/(actions)/github.action.ts diff --git a/src/app/(actions)/issue.tsx b/src/app/(actions)/issue.action.tsx similarity index 98% rename from src/app/(actions)/issue.tsx rename to src/app/(actions)/issue.action.tsx index 8ad9031b..013e0dd2 100644 --- a/src/app/(actions)/issue.tsx +++ b/src/app/(actions)/issue.action.tsx @@ -12,7 +12,7 @@ import { import { issueSearchListOutputValidator } from "~/app/(models)/dto/issue-search-output-validator"; import { searchIssues } from "~/app/(models)/issues/search"; -import { getAuthedUser } from "./auth"; +import { getAuthedUser } from "./auth.action"; import { cache } from "react"; import type { IssueSearchFilters } from "~/lib/shared/utils.shared"; diff --git a/src/app/(actions)/middlewares.ts b/src/app/(actions)/middlewares.ts index 9c426da8..9b5d89f4 100644 --- a/src/app/(actions)/middlewares.ts +++ b/src/app/(actions)/middlewares.ts @@ -1,6 +1,6 @@ import "server-only"; import { revalidatePath } from "next/cache"; -import { getSession, getAuthedUser } from "~/app/(actions)/auth"; +import { getSession, getAuthedUser } from "~/app/(actions)/auth.action"; import type { FunctionWithoutLastArg, OmitLastItemInArray } from "~/lib/types"; import type { Session } from "~/lib/server/session.server"; import type { User } from "~/lib/server/db/schema/user.sql"; diff --git a/src/app/(actions)/theme.ts b/src/app/(actions)/theme.action.ts similarity index 97% rename from src/app/(actions)/theme.ts rename to src/app/(actions)/theme.action.ts index b09c9741..33525f0b 100644 --- a/src/app/(actions)/theme.ts +++ b/src/app/(actions)/theme.action.ts @@ -1,7 +1,7 @@ "use server"; import { z } from "zod"; -import { getSession } from "./auth"; +import { getSession } from "./auth.action"; import { cache } from "react"; import { updateUserTheme } from "~/app/(models)/user"; import { revalidatePath } from "next/cache"; diff --git a/src/app/(actions)/user.ts b/src/app/(actions)/user.action.ts similarity index 100% rename from src/app/(actions)/user.ts rename to src/app/(actions)/user.action.ts diff --git a/src/app/(components)/header/index.tsx b/src/app/(components)/header/index.tsx index 04524e7d..85de44e8 100644 --- a/src/app/(components)/header/index.tsx +++ b/src/app/(components)/header/index.tsx @@ -20,7 +20,7 @@ import { } from "~/app/(components)/user-dropdown/user-dropdown.server"; // utils -import { getAuthedUser, getSession } from "~/app/(actions)/auth"; +import { getAuthedUser, getSession } from "~/app/(actions)/auth.action"; import { clsx } from "~/lib/shared/utils.shared"; // types diff --git a/src/app/(components)/icon-switcher.tsx b/src/app/(components)/icon-switcher.tsx index ff8f5689..f96f3a3d 100644 --- a/src/app/(components)/icon-switcher.tsx +++ b/src/app/(components)/icon-switcher.tsx @@ -1,7 +1,7 @@ "use client"; import * as React from "react"; -import type { Theme } from "~/app/(actions)/theme"; +import type { Theme } from "~/app/(actions)/theme.action"; function updateIcons(theme: Theme) { const userDefinedTheme = document.documentElement.dataset.theme !== "system"; diff --git a/src/app/(components)/issues/issue-list.tsx b/src/app/(components)/issues/issue-list.tsx index 4fe2e1af..1a896a49 100644 --- a/src/app/(components)/issues/issue-list.tsx +++ b/src/app/(components)/issues/issue-list.tsx @@ -23,7 +23,7 @@ import { pluralize } from "~/lib/shared/utils.shared"; import { preprocess, z } from "zod"; -import { getIssueList } from "~/app/(actions)/issue"; +import { getIssueList } from "~/app/(actions)/issue.action"; import { DEFAULT_ISSUE_SEARCH_QUERY, MAX_ITEMS_PER_PAGE @@ -31,7 +31,7 @@ import { // types import type { EmojiSortKey } from "./issue-row"; -import { getAuthedUser } from "~/app/(actions)/auth"; +import { getAuthedUser } from "~/app/(actions)/auth.action"; import { getRepositoryByOwnerAndName } from "~/app/(models)/repository"; export type IssueListProps = { @@ -51,7 +51,7 @@ export async function IssueList({ (arg) => Number(arg), z.number().int().min(1).catch(1) ); - let currentPage = pageSchema.parse(page); + const currentPage = pageSchema.parse(page); const filters = parseIssueFilterTokens( searchQuery ?? DEFAULT_ISSUE_SEARCH_QUERY diff --git a/src/app/(components)/issues/use-issue-assignee-list-query.ts b/src/app/(components)/issues/use-issue-assignee-list-query.ts index 1d769beb..31e9d421 100644 --- a/src/app/(components)/issues/use-issue-assignee-list-query.ts +++ b/src/app/(components)/issues/use-issue-assignee-list-query.ts @@ -1,5 +1,5 @@ import { useQuery } from "@tanstack/react-query"; -import { filterIssueAssignees } from "~/app/(actions)/issue"; +import { filterIssueAssignees } from "~/app/(actions)/issue.action"; export function useIssueAssigneeListQuery({ name = "", diff --git a/src/app/(components)/issues/use-issue-author-list-by-name-query.ts b/src/app/(components)/issues/use-issue-author-list-by-name-query.ts index c3699f00..c4b745a6 100644 --- a/src/app/(components)/issues/use-issue-author-list-by-name-query.ts +++ b/src/app/(components)/issues/use-issue-author-list-by-name-query.ts @@ -1,5 +1,5 @@ import { useQuery } from "@tanstack/react-query"; -import { filterIssueAuthorsByName } from "~/app/(actions)/issue"; +import { filterIssueAuthorsByName } from "~/app/(actions)/issue.action"; export function useIssueAuthorListByNameQuery({ name = "" diff --git a/src/app/(components)/issues/use-issue-author-list-query.ts b/src/app/(components)/issues/use-issue-author-list-query.ts index 926850e8..ea524a6c 100644 --- a/src/app/(components)/issues/use-issue-author-list-query.ts +++ b/src/app/(components)/issues/use-issue-author-list-query.ts @@ -1,5 +1,5 @@ import { useQuery } from "@tanstack/react-query"; -import { filterIssueAuthorsByUsername } from "~/app/(actions)/issue"; +import { filterIssueAuthorsByUsername } from "~/app/(actions)/issue.action"; export function useIssueAuthorListQuery({ name = "", diff --git a/src/app/(components)/issues/use-issue-label-list-query.ts b/src/app/(components)/issues/use-issue-label-list-query.ts index 4d22704d..e9e34404 100644 --- a/src/app/(components)/issues/use-issue-label-list-query.ts +++ b/src/app/(components)/issues/use-issue-label-list-query.ts @@ -1,5 +1,5 @@ import { useQuery } from "@tanstack/react-query"; -import { filterLabelsByName } from "~/app/(actions)/issue"; +import { filterLabelsByName } from "~/app/(actions)/issue.action"; export function useIssueLabelListByNameQuery({ name = "", diff --git a/src/app/(components)/theme-form.tsx b/src/app/(components)/theme-form.tsx index 089c50c0..fbc07e0e 100644 --- a/src/app/(components)/theme-form.tsx +++ b/src/app/(components)/theme-form.tsx @@ -5,10 +5,10 @@ import * as React from "react"; import { ThemeCard } from "./theme-card"; // utils -import { updateTheme } from "~/app/(actions)/theme"; +import { updateTheme } from "~/app/(actions)/theme.action"; // types -import type { Theme } from "~/app/(actions)/theme"; +import type { Theme } from "~/app/(actions)/theme.action"; import { SubmitButton } from "./submit-button"; export type ThemeFormProps = { diff --git a/src/app/(components)/toast/toaster.server.tsx b/src/app/(components)/toast/toaster.server.tsx index 41d99fe6..dbdd66c5 100644 --- a/src/app/(components)/toast/toaster.server.tsx +++ b/src/app/(components)/toast/toaster.server.tsx @@ -1,7 +1,7 @@ import * as React from "react"; // utils -import { getSession } from "~/app/(actions)/auth"; +import { getSession } from "~/app/(actions)/auth.action"; import { ToasterClient } from "./toaster.client"; import { headers } from "next/headers"; diff --git a/src/app/(components)/update-user-infos-form.tsx b/src/app/(components)/update-user-infos-form.tsx index b3b047c9..630a6f27 100644 --- a/src/app/(components)/update-user-infos-form.tsx +++ b/src/app/(components)/update-user-infos-form.tsx @@ -8,7 +8,7 @@ import { Textarea } from "./textarea"; import { SubmitButton } from "./submit-button"; // utils -import { updateUserProfile } from "~/app/(actions)/user"; +import { updateUserProfile } from "~/app/(actions)/user.action"; // types import type { UpdateUserProfileInfosInput } from "~/app/(models)/dto/update-profile-info-input-validator"; diff --git a/src/app/(components)/user-dropdown/user-dropdown.client.tsx b/src/app/(components)/user-dropdown/user-dropdown.client.tsx index a9d27fc4..f00ff41c 100644 --- a/src/app/(components)/user-dropdown/user-dropdown.client.tsx +++ b/src/app/(components)/user-dropdown/user-dropdown.client.tsx @@ -11,7 +11,7 @@ import { } from "@primer/octicons-react"; // utils -import { logoutUser } from "~/app/(actions)/auth"; +import { logoutUser } from "~/app/(actions)/auth.action"; // types export type UserDropdownProps = { diff --git a/src/app/(components)/user-dropdown/user-dropdown.server.tsx b/src/app/(components)/user-dropdown/user-dropdown.server.tsx index 0d84b6cb..28afd6dc 100644 --- a/src/app/(components)/user-dropdown/user-dropdown.server.tsx +++ b/src/app/(components)/user-dropdown/user-dropdown.server.tsx @@ -1,5 +1,5 @@ import * as React from "react"; -import { getAuthedUser } from "~/app/(actions)/auth"; +import { getAuthedUser } from "~/app/(actions)/auth.action"; import { UserDropdown as UserDropdownClient } from "./user-dropdown.client"; export async function UserDropdown() { diff --git a/src/app/(routes)/(app)/[user]/[repository]/issues/page.tsx b/src/app/(routes)/(app)/[user]/[repository]/issues/page.tsx index f0552204..27b59fc8 100644 --- a/src/app/(routes)/(app)/[user]/[repository]/issues/page.tsx +++ b/src/app/(routes)/(app)/[user]/[repository]/issues/page.tsx @@ -13,7 +13,7 @@ import { IssueList } from "~/app/(components)/issues/issue-list"; // utils import { clsx } from "~/lib/shared/utils.shared"; -import { getAuthedUser } from "~/app/(actions)/auth"; +import { getAuthedUser } from "~/app/(actions)/auth.action"; import { getLabelsCount } from "~/app/(models)/label"; // types diff --git a/src/app/(routes)/(app)/[user]/[repository]/page.tsx b/src/app/(routes)/(app)/[user]/[repository]/page.tsx index 8c6ad7da..283402e3 100644 --- a/src/app/(routes)/(app)/[user]/[repository]/page.tsx +++ b/src/app/(routes)/(app)/[user]/[repository]/page.tsx @@ -23,8 +23,8 @@ import { Markdown } from "~/app/(components)/markdown/markdown"; import { Cache } from "~/app/(components)/cache/cache"; // utils -import { getSession } from "~/app/(actions)/auth"; -import { getGithubRepoData } from "~/app/(actions)/github"; +import { getSession } from "~/app/(actions)/auth.action"; +import { getGithubRepoData } from "~/app/(actions)/github.action"; import { getRepositoryByOwnerAndName } from "~/app/(models)/repository"; import { AUTHOR_AVATAR_URL, diff --git a/src/app/(routes)/(app)/[user]/[repository]/stargazers/page.tsx b/src/app/(routes)/(app)/[user]/[repository]/stargazers/page.tsx index 50b02ead..c785f868 100644 --- a/src/app/(routes)/(app)/[user]/[repository]/stargazers/page.tsx +++ b/src/app/(routes)/(app)/[user]/[repository]/stargazers/page.tsx @@ -10,7 +10,7 @@ import { Pagination } from "~/app/(components)/pagination"; import { Skeleton } from "~/app/(components)/skeleton"; // utils -import { getGithubRepoData } from "~/app/(actions)/github"; +import { getGithubRepoData } from "~/app/(actions)/github.action"; import { formatDate, range, reversePaginate } from "~/lib/shared/utils.shared"; // types @@ -68,6 +68,7 @@ async function StargazersPageContent({ currentPage }: { currentPage: number }) { {stargazer.login} diff --git a/src/app/(routes)/(app)/settings/account/page.tsx b/src/app/(routes)/(app)/settings/account/page.tsx index 97e5d1ed..3e133ea4 100644 --- a/src/app/(routes)/(app)/settings/account/page.tsx +++ b/src/app/(routes)/(app)/settings/account/page.tsx @@ -5,7 +5,10 @@ import { UpdateUserInfosForm } from "~/app/(components)/update-user-infos-form"; import { Button } from "~/app/(components)/button"; // utils -import { getAuthedUser, redirectIfNotAuthed } from "~/app/(actions)/auth"; +import { + getAuthedUser, + redirectIfNotAuthed +} from "~/app/(actions)/auth.action"; import { updateUserProfileInfosInputValidator } from "~/app/(models)/dto/update-profile-info-input-validator"; // types diff --git a/src/app/(routes)/(app)/settings/appearance/page.tsx b/src/app/(routes)/(app)/settings/appearance/page.tsx index 451f81e3..eeb0be53 100644 --- a/src/app/(routes)/(app)/settings/appearance/page.tsx +++ b/src/app/(routes)/(app)/settings/appearance/page.tsx @@ -5,8 +5,8 @@ import * as React from "react"; import { ThemeForm } from "~/app/(components)/theme-form"; // utils -import { redirectIfNotAuthed } from "~/app/(actions)/auth"; -import { getTheme } from "~/app/(actions)/theme"; +import { redirectIfNotAuthed } from "~/app/(actions)/auth.action"; +import { getTheme } from "~/app/(actions)/theme.action"; // types import type { Metadata } from "next"; diff --git a/src/app/(routes)/(app)/settings/layout.tsx b/src/app/(routes)/(app)/settings/layout.tsx index e2ac98c3..f7df1e76 100644 --- a/src/app/(routes)/(app)/settings/layout.tsx +++ b/src/app/(routes)/(app)/settings/layout.tsx @@ -4,7 +4,10 @@ import { Avatar } from "~/app/(components)/avatar"; import { VerticalNavlist } from "~/app/(components)/vertical-navlist"; // utils -import { getAuthedUser, redirectIfNotAuthed } from "~/app/(actions)/auth"; +import { + getAuthedUser, + redirectIfNotAuthed +} from "~/app/(actions)/auth.action"; import { clsx } from "~/lib/shared/utils.shared"; export default async function SettingsLayout({ diff --git a/src/app/(routes)/(app)/settings/page.tsx b/src/app/(routes)/(app)/settings/page.tsx index e4bb4c54..a9846e66 100644 --- a/src/app/(routes)/(app)/settings/page.tsx +++ b/src/app/(routes)/(app)/settings/page.tsx @@ -1,5 +1,5 @@ import { redirect } from "next/navigation"; -import { redirectIfNotAuthed } from "~/app/(actions)/auth"; +import { redirectIfNotAuthed } from "~/app/(actions)/auth.action"; export default async function Page() { await redirectIfNotAuthed("/settings/account"); diff --git a/src/app/(routes)/api/auth/callback/route.ts b/src/app/(routes)/api/auth/callback/route.ts index e28c036f..37c20b07 100644 --- a/src/app/(routes)/api/auth/callback/route.ts +++ b/src/app/(routes)/api/auth/callback/route.ts @@ -1,5 +1,5 @@ import { redirect } from "next/navigation"; -import { loginUser } from "~/app/(actions)/auth"; +import { loginUser } from "~/app/(actions)/auth.action"; import { env } from "~/env"; import { isValidURLPathname } from "~/lib/shared/utils.shared"; import type { NextRequest } from "next/server"; diff --git a/src/app/(routes)/login/page.tsx b/src/app/(routes)/login/page.tsx index dba15edf..288bcdad 100644 --- a/src/app/(routes)/login/page.tsx +++ b/src/app/(routes)/login/page.tsx @@ -5,7 +5,7 @@ import { Card } from "~/app/(components)/card"; import Link from "next/link"; // utils -import { authenticateWithGithub } from "~/app/(actions)/auth"; +import { authenticateWithGithub } from "~/app/(actions)/auth.action"; // types import type { PageProps } from "~/lib/types"; @@ -85,6 +85,7 @@ export default function LoginPage({ href="https://fredkiss.dev" target="_blank" className="text-accent" + rel="noreferrer" > Fredkiss3 @@ -93,6 +94,7 @@ export default function LoginPage({ href="https://github.com/Fredkiss3/gh-next" target="_blank" className="text-accent" + rel="noreferrer" > source code diff --git a/src/app/layout.tsx b/src/app/layout.tsx index a8cdb08a..c42a7b70 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -12,7 +12,7 @@ import { ClientProviders } from "./client-providers"; // utils import { GeistSans } from "geist/font/sans"; -import { getTheme } from "~/app/(actions)/theme"; +import { getTheme } from "~/app/(actions)/theme.action"; import { clsx } from "~/lib/shared/utils.shared"; // types