Skip to content

Commit

Permalink
🚚 move actions into *.action files
Browse files Browse the repository at this point in the history
  • Loading branch information
Fredkiss3 committed Dec 21, 2023
1 parent 25799df commit d47792f
Show file tree
Hide file tree
Showing 28 changed files with 39 additions and 30 deletions.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion src/app/(actions)/middlewares.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/app/(components)/header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/app/(components)/icon-switcher.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
6 changes: 3 additions & 3 deletions src/app/(components)/issues/issue-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ 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
} from "~/lib/shared/constants";

// 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 = {
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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 = "",
Expand Down
Original file line number Diff line number Diff line change
@@ -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 = ""
Expand Down
2 changes: 1 addition & 1 deletion src/app/(components)/issues/use-issue-author-list-query.ts
Original file line number Diff line number Diff line change
@@ -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 = "",
Expand Down
2 changes: 1 addition & 1 deletion src/app/(components)/issues/use-issue-label-list-query.ts
Original file line number Diff line number Diff line change
@@ -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 = "",
Expand Down
4 changes: 2 additions & 2 deletions src/app/(components)/theme-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion src/app/(components)/toast/toaster.server.tsx
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
2 changes: 1 addition & 1 deletion src/app/(components)/update-user-infos-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion src/app/(routes)/(app)/[user]/[repository]/issues/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/app/(routes)/(app)/[user]/[repository]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -68,6 +68,7 @@ async function StargazersPageContent({ currentPage }: { currentPage: number }) {
<a
href={`https://github.com/${stargazer.login}`}
target="_blank"
rel="noreferrer"
>
{stargazer.login}
</a>
Expand Down
5 changes: 4 additions & 1 deletion src/app/(routes)/(app)/settings/account/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/app/(routes)/(app)/settings/appearance/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
5 changes: 4 additions & 1 deletion src/app/(routes)/(app)/settings/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion src/app/(routes)/(app)/settings/page.tsx
Original file line number Diff line number Diff line change
@@ -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");
Expand Down
2 changes: 1 addition & 1 deletion src/app/(routes)/api/auth/callback/route.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
4 changes: 3 additions & 1 deletion src/app/(routes)/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -85,6 +85,7 @@ export default function LoginPage({
href="https://fredkiss.dev"
target="_blank"
className="text-accent"
rel="noreferrer"
>
Fredkiss3
</a>
Expand All @@ -93,6 +94,7 @@ export default function LoginPage({
href="https://github.com/Fredkiss3/gh-next"
target="_blank"
className="text-accent"
rel="noreferrer"
>
source code
</a>
Expand Down
2 changes: 1 addition & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d47792f

Please sign in to comment.