Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
41beed25
Commit
41beed25
authored
Mar 31, 2023
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove node.js api endpoint
parent
03e278e1
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
19 additions
and
39 deletions
+19
-39
pre-commit
.husky/pre-commit
+0
-4
config.ts
configs/app/config.ts
+1
-1
.env.common
configs/envs/.env.common
+1
-1
useNavItems.tsx
lib/hooks/useNavItems.tsx
+1
-1
[id].ts
pages/api/marketplace/[id].ts
+0
-17
index.ts
pages/api/marketplace/index.ts
+0
-10
nextjs-routes.d.ts
types/nextjs-routes.d.ts
+0
-2
useMarketplaceApps.tsx
ui/apps/useMarketplaceApps.tsx
+2
-1
MarketplaceApp.tsx
ui/pages/MarketplaceApp.tsx
+14
-2
No files found.
.husky/pre-commit
View file @
41beed25
...
...
@@ -14,8 +14,4 @@ for file in `git diff --diff-filter=ACMRT --cached --name-only | grep ".svg\$"`
git add
$file
done
# format svg
echo
🧿 Running marketplace config validator...
./deploy/scripts/validate_marketplace_config.sh
echo
✅ All pre-commit
jobs
are
done
configs/app/config.ts
View file @
41beed25
...
...
@@ -86,7 +86,7 @@ const config = Object.freeze({
featuredNetworks
:
parseEnvJson
<
Array
<
FeaturedNetwork
>>
(
getEnvValue
(
process
.
env
.
NEXT_PUBLIC_FEATURED_NETWORKS
))
||
[],
blockScoutVersion
:
getEnvValue
(
process
.
env
.
NEXT_PUBLIC_BLOCKSCOUT_VERSION
),
isAccountSupported
:
getEnvValue
(
process
.
env
.
NEXT_PUBLIC_IS_ACCOUNT_SUPPORTED
)
===
'
true
'
,
isMarketplaceAvailable
:
Boolean
(
getEnvValue
(
process
.
env
.
NEXT_PUBLIC_MARKETPLACE_CONFIG_URL
)
),
marketplaceConfigUrl
:
getEnvValue
(
process
.
env
.
NEXT_PUBLIC_MARKETPLACE_CONFIG_URL
),
marketplaceSubmitForm
:
getEnvValue
(
process
.
env
.
NEXT_PUBLIC_MARKETPLACE_SUBMIT_FORM
),
protocol
:
appSchema
,
host
:
appHost
,
...
...
configs/envs/.env.common
View file @
41beed25
...
...
@@ -10,7 +10,7 @@ NEXT_PUBLIC_BLOCKSCOUT_VERSION=v4.1.7-beta
NEXT_PUBLIC_FOOTER_GITHUB_LINK=https://github.com/blockscout/blockscout
NEXT_PUBLIC_FOOTER_TWITTER_LINK=https://www.twitter.com/blockscoutcom
NEXT_PUBLIC_API_SPEC_URL=https://raw.githubusercontent.com/blockscout/blockscout-api-v2-swagger/main/swagger.yaml
NEXT_PUBLIC_MARKETPLACE_CONFIG_URL=https://raw.githubusercontent.com/blockscout/frontend-configs/main/configs/marketplace/eth-goerli.json
# api config
NEXT_PUBLIC_API_HOST=blockscout.com
...
...
lib/hooks/useNavItems.tsx
View file @
41beed25
...
...
@@ -64,7 +64,7 @@ export function isInternalItem(item: NavItem): item is NavItemInternal {
}
export
default
function
useNavItems
():
ReturnType
{
const
isMarketplaceAvailable
=
appConfig
.
isMarketplaceAvailable
&&
appConfig
.
network
.
rpcUrl
;
const
isMarketplaceAvailable
=
Boolean
(
appConfig
.
marketplaceConfigUrl
&&
appConfig
.
network
.
rpcUrl
)
;
const
hasAPIDocs
=
appConfig
.
apiDoc
.
specUrl
;
const
router
=
useRouter
();
...
...
pages/api/marketplace/[id].ts
deleted
100644 → 0
View file @
03e278e1
import
type
{
NextApiRequest
,
NextApiResponse
}
from
'
next
'
;
import
config
from
'
configs/marketplace/eth-goerli.json
'
;
import
{
httpLogger
}
from
'
lib/api/logger
'
;
export
default
async
function
marketplaceAppIdHandler
(
_req
:
NextApiRequest
,
res
:
NextApiResponse
)
{
httpLogger
(
_req
,
res
);
const
id
=
_req
.
query
.
id
;
const
app
=
config
.
find
(
app
=>
app
.
id
===
id
);
if
(
!
app
)
{
return
res
.
status
(
404
).
json
({
error
:
'
Not found
'
});
}
res
.
status
(
200
).
json
(
app
);
}
pages/api/marketplace/index.ts
deleted
100644 → 0
View file @
03e278e1
import
type
{
NextApiRequest
,
NextApiResponse
}
from
'
next
'
;
import
config
from
'
configs/marketplace/eth-goerli.json
'
;
import
{
httpLogger
}
from
'
lib/api/logger
'
;
export
default
async
function
marketplaceIndexHandler
(
_req
:
NextApiRequest
,
res
:
NextApiResponse
)
{
httpLogger
(
_req
,
res
);
res
.
status
(
200
).
json
(
config
);
}
types/nextjs-routes.d.ts
View file @
41beed25
...
...
@@ -15,8 +15,6 @@ declare module "nextjs-routes" {
|
DynamicRoute
<
"
/address/[hash]/contract_verification
"
,
{
"
hash
"
:
string
}
>
|
DynamicRoute
<
"
/address/[hash]
"
,
{
"
hash
"
:
string
}
>
|
StaticRoute
<
"
/api/csrf
"
>
|
DynamicRoute
<
"
/api/marketplace/[id]
"
,
{
"
id
"
:
string
}
>
|
StaticRoute
<
"
/api/marketplace
"
>
|
StaticRoute
<
"
/api/media-type
"
>
|
StaticRoute
<
"
/api/proxy
"
>
|
StaticRoute
<
"
/api-docs
"
>
...
...
ui/apps/useMarketplaceApps.tsx
View file @
41beed25
...
...
@@ -3,6 +3,7 @@ import React, { useCallback, useEffect, useState } from 'react';
import
type
{
AppItemOverview
,
MarketplaceCategoriesIds
}
from
'
types/client/apps
'
;
import
appConfig
from
'
configs/app/config
'
;
import
type
{
ResourceError
}
from
'
lib/api/resources
'
;
import
useDebounce
from
'
lib/hooks/useDebounce
'
;
import
useApiFetch
from
'
lib/hooks/useFetch
'
;
...
...
@@ -36,7 +37,7 @@ export default function useMarketplaceApps() {
const
apiFetch
=
useApiFetch
();
const
{
isLoading
,
isError
,
error
,
data
}
=
useQuery
<
unknown
,
ResourceError
<
unknown
>
,
Array
<
AppItemOverview
>>
(
[
'
marketplace-apps
'
],
async
()
=>
apiFetch
(
'
/node-api/marketplace
'
),
async
()
=>
apiFetch
(
appConfig
.
marketplaceConfigUrl
||
'
'
),
{
select
:
(
data
)
=>
(
data
as
Array
<
AppItemOverview
>
).
sort
((
a
,
b
)
=>
a
.
title
.
localeCompare
(
b
.
title
)),
});
...
...
ui/pages/MarketplaceApp.tsx
View file @
41beed25
...
...
@@ -27,8 +27,20 @@ const MarketplaceApp = () => {
const
id
=
getQueryParamString
(
router
.
query
.
id
);
const
{
isLoading
,
isError
,
error
,
data
}
=
useQuery
<
unknown
,
ResourceError
<
unknown
>
,
AppItemOverview
>
(
[
'
marketplace-app
'
,
{
id
}
],
async
()
=>
apiFetch
(
`/node-api/marketplace/
${
id
}
`
),
[
'
marketplace-apps
'
],
async
()
=>
{
const
result
=
await
apiFetch
<
Array
<
AppItemOverview
>
,
unknown
>
(
appConfig
.
marketplaceConfigUrl
||
''
);
if
(
!
Array
.
isArray
(
result
))
{
throw
result
;
}
const
item
=
result
.
find
((
app
:
AppItemOverview
)
=>
app
.
id
===
id
);
if
(
!
item
)
{
throw
{
status
:
404
};
}
return
item
;
},
);
const
[
isFrameLoading
,
setIsFrameLoading
]
=
useState
(
isLoading
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment