Skip to content

Commit

Permalink
feat: adding suggest and approve endpoint for the map (#3937)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasburtey authored Feb 6, 2024
1 parent f548dc8 commit d2f6f35
Show file tree
Hide file tree
Showing 55 changed files with 1,298 additions and 629 deletions.
6 changes: 2 additions & 4 deletions apps/admin-panel/app/account/[uuid]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import BusinessMapUpdate from "../../../components/account/business-map-update"
import Details from "../../../components/account/details"
import AccountUpdate from "../../../components/account/update"
import { Merchants } from "../../../components/merchants/details"
import {
AccountDetailsByAccountIdDocument,
AccountDetailsByAccountIdQuery,
Expand All @@ -19,8 +19,6 @@ export default async function AccountDetails({ params }: { params: { uuid: strin

const auditedAccount = data?.accountDetailsByAccountId

console.log({ auditedAccount }, "data")

return (
auditedAccount && (
<>
Expand All @@ -31,9 +29,9 @@ export default async function AccountDetails({ params }: { params: { uuid: strin
<Details auditedAccount={auditedAccount} />
<div className="grid grid-cols-1 gap-4">
<AccountUpdate auditedAccount={auditedAccount} />
<BusinessMapUpdate auditedAccount={auditedAccount} />
</div>
</div>
<Merchants merchants={auditedAccount.merchants} />
</>
)
)
Expand Down
7 changes: 3 additions & 4 deletions apps/admin-panel/app/account/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
"use client"

import Image from "next/image"
/* eslint @typescript-eslint/ban-ts-comment: "off" */
// @ts-ignore-next-line no-implicit-any error
import { experimental_useFormState as useFormState } from "react-dom"

import { useFormState } from "react-dom"

import SearchIcon from "../../components/icons/search.svg"

import { accountSearch } from "./search-action"

const initialState = {
message: null,
message: "",
}

export default function Account({ children }: { children: React.ReactNode }) {
Expand Down
27 changes: 27 additions & 0 deletions apps/admin-panel/app/merchants/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Merchants } from "../../components/merchants/details"
import {
MerchantsPendingApprovalDocument,
MerchantsPendingApprovalQuery,
MerchantsPendingApprovalQueryVariables,
} from "../../generated"
import { getClient } from "../graphql-rsc"

export default async function MerchantScreen() {
const query = await getClient().query<
MerchantsPendingApprovalQuery,
MerchantsPendingApprovalQueryVariables
>({
query: MerchantsPendingApprovalDocument,
})

const merchants = query?.data.merchantsPendingApproval ?? []

return (
<>
<h1 className="mx-6 mt-6 text-2xl font-semibold text-gray-700">
{"Merchants pending validation"}
</h1>
<Merchants merchants={merchants} />
</>
)
}
10 changes: 3 additions & 7 deletions apps/admin-panel/app/transactions/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
"use client"

import Image from "next/image"
/* eslint @typescript-eslint/ban-ts-comment: "off" */
// @ts-ignore-next-line no-implicit-any error
import { experimental_useFormState as useFormState } from "react-dom"

import SearchIcon from "../../components/icons/search.svg"
import { useFormState } from "react-dom"

/* eslint @typescript-eslint/ban-ts-comment: "off" */
// @ts-ignore-next-line no-implicit-any error
import SearchIcon from "../../components/icons/search.svg"

import { transactionSearch } from "./search-action"

const initialState = {
message: null,
message: "",
}

export default function Account({ children }: { children: React.ReactNode }) {
Expand Down
3 changes: 3 additions & 0 deletions apps/admin-panel/app/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { AuditedAccount } from "../generated"

export type AuditedAccountMainValues = Omit<AuditedAccount, "wallets">
2 changes: 1 addition & 1 deletion apps/admin-panel/codegen.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
overwrite: true
schema:
- "https://raw.githubusercontent.com/GaloyMoney/galoy/main/core/api/src/graphql/admin/schema.graphql"
- "../../core/api/src/graphql/admin/schema.graphql"
documents:
- "graphql.gql"
generates:
Expand Down
153 changes: 0 additions & 153 deletions apps/admin-panel/components/account/business-map-update.tsx

This file was deleted.

31 changes: 2 additions & 29 deletions apps/admin-panel/components/account/details.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { AuditedAccount } from "../../generated"
import { AuditedAccountMainValues } from "../../app/types"
import { formatDate } from "../../app/utils"

const Details: React.FC<{
auditedAccount: AuditedAccount
auditedAccount: AuditedAccountMainValues
}> = ({ auditedAccount }) => {
return (
<div className="shadow p-6 min-w-0 rounded-lg shadow-xs overflow-hidden bg-white grid grid-cols-2 gap-4">
Expand All @@ -26,33 +26,6 @@ const Details: React.FC<{
<p className="mb-4 font-semibold text-gray-600">Username</p>
<p className={`text-gray-600`}>{auditedAccount.username || "--"}</p>
</div>
<div>
<p className="mb-4 font-semibold text-gray-600">Title</p>
<p className={`text-gray-600`}>{auditedAccount.title || "--"}</p>
</div>
<div>
<p className="mb-4 font-semibold text-gray-600">Coordinates</p>
<p className={`text-gray-600`}>
{auditedAccount.coordinates ? (
<a
target="_blank"
rel="noreferrer"
className="underline"
href={`https://maps.google.com/?q=${
auditedAccount.coordinates?.latitude +
"," +
auditedAccount.coordinates?.longitude
}`}
>
{auditedAccount.coordinates?.latitude +
", " +
auditedAccount.coordinates?.longitude}
</a>
) : (
"--"
)}
</p>
</div>
<div className="col-span-2">
<p className="mb-4 font-semibold text-gray-600">Created At</p>
<p className={`text-gray-600`}>{formatDate(auditedAccount.createdAt)}</p>
Expand Down
6 changes: 3 additions & 3 deletions apps/admin-panel/components/account/update.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ import {
AccountUpdateStatusDocument,
AccountUpdateStatusMutation,
AccountUpdateStatusMutationVariables,
AuditedAccount,
} from "../../generated"

import ConfirmForm from "./confirm"
import ConfirmForm from "../confirm"
import { AuditedAccountMainValues } from "../../app/types"

type PropType = {
auditedAccount: AuditedAccount
auditedAccount: AuditedAccountMainValues
}

const updateLevel = async (formData: FormData) => {
Expand Down
File renamed without changes.
8 changes: 8 additions & 0 deletions apps/admin-panel/components/icons/search-globe.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d2f6f35

Please sign in to comment.