Add fetch checker utility to integrations page
This commit is contained in:
@@ -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>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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?__
|
||||
|
||||
Reference in New Issue
Block a user