Add fetch checker utility to integrations page

This commit is contained in:
Lorexia
2023-10-10 18:08:19 +02:00
parent 3a624070ad
commit 022687526a
2 changed files with 57 additions and 1 deletions
@@ -0,0 +1,47 @@
import React, { useState } from 'react';
import TextField from '@mui/material/TextField';
import Button from '@mui/material/Button';
import Stack from '@mui/material/Stack';
import Box from '@mui/material/Box';
export const GitHubRepoSearch = () => {
const [repoUrl, setRepoUrl] = useState('');
const handleSearch = () => {
if(!repoUrl || repoUrl.length < 1 ) {
return window.alert("Please enter a valid Github URL!")
}
const matchedRepo = repoUrl.match(/https:\/\/github\.com\/(.*)/)[1]
// Construct the search URL
const searchUrl = `https://github.com/search?q=repo:${matchedRepo} fetch(&type=code`;
// Redirect the user to the search results page
window.location.href = searchUrl;
};
return (
<Box padding={3}>
<Box>
<TextField
type="text"
placeholder="Enter GitHub Repo URL"
value={repoUrl}
onChange={(e) => setRepoUrl(e.target.value)}
size="small"
sx={{width: "400px"}}
/>
<Button
variant="outlined"
onClick={handleSearch}
size="medium"
sx={{ marginLeft: 2, marginTop: 0.2 }}
>
Check mixFetch
</Button>
</Box>
</Box>
);
}
+10 -1
View File
@@ -1,3 +1,6 @@
import Box from '@mui/material/Box';
import { GitHubRepoSearch } from '../../code-snippets/mixfetchurl';
# Integrations page
### Existing resources
@@ -11,7 +14,13 @@ If you're unsure where to start, the following set of questions should help you
__1. Does your app rely on using `fetch` for its network traffic and remote connections?__
If yes, explore implementing `mixfetch`to route app traffic through the mixnet.
Check whether mixFetch can be used by entering your repository's URL below:
<GitHubRepoSearch />
If yes, explore implementing `mixfetch` to route app traffic through the mixnet.
If not:
__2. Is your app developed in TS/JS or Rust?__