-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #524 from chatch/update-react-18-remix
Update to react 18 and use remix.run
- Loading branch information
Showing
254 changed files
with
23,730 additions
and
38,507 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# See https://help.github.com/ignore-files/ for more about ignoring files. | ||
|
||
junit.xml | ||
|
||
# dependencies | ||
/node_modules | ||
|
||
# testing | ||
/coverage | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
.env | ||
.vscode | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
yarn.lock | ||
|
||
.gitsigners | ||
|
||
# remix | ||
/.cache | ||
/build | ||
/public/build | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,9 @@ yarn-error.log* | |
yarn.lock | ||
|
||
.gitsigners | ||
|
||
# remix | ||
/.cache | ||
/build | ||
/public/build | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# syntax = docker/dockerfile:1 | ||
|
||
# Adjust NODE_VERSION as desired | ||
ARG NODE_VERSION=18.17.0 | ||
FROM node:${NODE_VERSION}-slim as base | ||
|
||
LABEL fly_launch_runtime="Remix" | ||
|
||
# Remix app lives here | ||
WORKDIR /app | ||
|
||
# Set production environment | ||
ENV NODE_ENV="production" | ||
|
||
|
||
# Throw-away build stage to reduce size of final image | ||
FROM base as build | ||
|
||
# Install packages needed to build node modules | ||
RUN apt-get update -qq && \ | ||
apt-get install -y build-essential pkg-config python-is-python3 | ||
|
||
# Install node modules | ||
COPY --link package-lock.json package.json ./ | ||
RUN npm ci --include=dev | ||
|
||
# Copy application code | ||
COPY --link . . | ||
|
||
# Build application | ||
RUN npm run build | ||
|
||
# Remove development dependencies | ||
RUN npm prune --omit=dev | ||
|
||
|
||
# Final stage for app image | ||
FROM base | ||
|
||
# Copy built application | ||
COPY --from=build /app /app | ||
|
||
# Start the server by default, this can be overwritten at runtime | ||
EXPOSE 3000 | ||
CMD [ "npm", "run", "start" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,210 @@ | ||
|
||
import Col from "react-bootstrap/Col" | ||
import Container from "react-bootstrap/Container" | ||
import Row from "react-bootstrap/Row" | ||
import FormControl from "react-bootstrap/FormControl" | ||
import InputGroup from "react-bootstrap/InputGroup" | ||
import Modal from "react-bootstrap/Modal" | ||
|
||
import { useIntl } from "react-intl" | ||
|
||
import { searchStrToPath } from "./lib/search" | ||
import { isSecretKey } from "./lib/stellar/utils" | ||
import { useState } from "react" | ||
import { useNavigate } from "@remix-run/react" | ||
|
||
import searchSvg from '../public/search.svg' | ||
import infoCircleSvg from '../public/info-circle.svg' | ||
|
||
const HelpModal = ({ showHelp, handleCloseFn }: { showHelp: boolean, handleCloseFn: () => void }) => ( | ||
<Modal id="help-modal" show={showHelp} onHide={handleCloseFn}> | ||
<Modal.Header closeButton> | ||
<Modal.Title> | ||
Search Help | ||
</Modal.Title> | ||
</Modal.Header> | ||
<Modal.Body style={{ color: "#96a2b4" }}> | ||
<div> | ||
<div className="search-sub-heading">Stellar Address</div> | ||
<div className="search-desc">Also called a{" "} | ||
<a | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
href="https://www.stellar.org/developers/guides/concepts/federation.html#stellar-addresses" | ||
> | ||
Stellar federated address | ||
</a> | ||
<img | ||
src="/search/search_stellar_address.png" | ||
alt="search by ledger" | ||
/> | ||
</div> | ||
</div> | ||
<div> | ||
<div className="search-sub-heading">Account ID</div> | ||
<div className="search-desc"> | ||
Also called a Public Key or Public Address | ||
<img | ||
src="/search/search_account_public.png" | ||
alt="search by public account address" | ||
width="100%" | ||
/> | ||
</div> | ||
</div> | ||
<div> | ||
<div className="search-sub-heading">Transaction Hash</div> | ||
<img | ||
src="/search/search_tx_hash.png" | ||
alt="search by transaction hash" | ||
width="100%" | ||
/> | ||
</div> | ||
<div> | ||
<div className="search-sub-heading">Contract Address or Hash</div> | ||
<img | ||
src="/search/search_contract.png" | ||
alt="search by contract address" | ||
width="100%" | ||
/> | ||
</div> | ||
<div> | ||
<div className="search-sub-heading">Ledger</div> | ||
<img | ||
src="/search/search_ledger.png" | ||
alt="search by ledger" | ||
/> | ||
</div> | ||
<div className="search-sub-heading">Anchor Name</div> | ||
<div> | ||
<div className="search-desc"> | ||
as listed on the{" "} | ||
<a | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
href="https://steexp.com/anchors" | ||
> | ||
Anchors Page | ||
</a> | ||
</div> | ||
<div> | ||
<br /> | ||
<div className="search-desc"> | ||
<div>Full name:</div> | ||
<img | ||
src="/search/search_anchor_name_full.png" | ||
alt="search by anchor full name" | ||
/> | ||
</div> | ||
<br /> | ||
<div className="search-desc"> | ||
<div>Partial name:</div> | ||
<img | ||
src="/search/search_anchor_name_partial.png" | ||
alt="search by anchor partial name" | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
<div> | ||
<div className="search-sub-heading">Asset Code</div> | ||
<img | ||
src="/search/search_asset.png" | ||
alt="search by asset code" | ||
/> | ||
</div> | ||
<hr /> | ||
<h4>OpenSearch:</h4> | ||
<div> | ||
Stellar Explorer supports{" "} | ||
<a | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
href="https://developer.mozilla.org/en-US/docs/Web/OpenSearch" | ||
> | ||
OpenSearch | ||
</a> | ||
. This allows you to search directly from your browser search box or | ||
search bar. You should see something like the following when you | ||
navigate to Stellar Explorer then open the search box. Install it from | ||
there: | ||
<br /> | ||
<img | ||
src="https://user-images.githubusercontent.com/1477978/33513399-8cf8ac52-d774-11e7-9585-ddc5467a5a2d.png" | ||
alt="search by transaction hash" | ||
width="80%" | ||
/> | ||
</div> | ||
</Modal.Body> | ||
</Modal> | ||
) | ||
|
||
export default function SearchBox() { | ||
const { formatMessage } = useIntl() | ||
|
||
const [searchStr, setSearchStr] = useState('') | ||
const [showHelp, setShowHelp] = useState(false) | ||
|
||
const navigate = useNavigate() | ||
|
||
const handleCloseFn = () => setShowHelp(false) | ||
const handleClickFn = () => setShowHelp(true) | ||
|
||
const searchHandler = (event: any) => { | ||
console.log(`searchHandler entry [${searchStr}]`) | ||
event.preventDefault() | ||
|
||
const matchPath = searchStrToPath(searchStr) | ||
console.log(`matchPath ${matchPath}`) | ||
|
||
// #62 security: clear search box if user put the secret key there | ||
if (isSecretKey(searchStr)) { | ||
setSearchStr("") | ||
} | ||
|
||
if (matchPath == null) | ||
return | ||
|
||
return navigate(matchPath) | ||
} | ||
|
||
return ( | ||
<Container> | ||
<Row> | ||
<Col id="search-container"> | ||
<form onSubmit={searchHandler}> | ||
<InputGroup> | ||
<FormControl | ||
type="text" | ||
onChange={(e) => setSearchStr(e.target.value)} | ||
placeholder={formatMessage({ | ||
id: "search.placeHolder", | ||
})} | ||
value={searchStr} | ||
/> | ||
<InputGroup.Text> | ||
<img | ||
src={searchSvg} | ||
style={{ color: '#4c5667', height: 16, width: 16 }} | ||
onClick={searchHandler} | ||
/> | ||
</InputGroup.Text> | ||
<InputGroup.Text style={{ background: 'none', border: 0, color: 'white', fontSize: 20 }}> | ||
<img | ||
src={infoCircleSvg} | ||
style={{ color: 'white', height: 24, width: 24 }} | ||
onClick={handleClickFn} | ||
/> | ||
</InputGroup.Text> | ||
</InputGroup> | ||
</form> | ||
{showHelp && ( | ||
<HelpModal | ||
handleCloseFn={handleCloseFn} | ||
showHelp={showHelp} | ||
/> | ||
)} | ||
</Col> | ||
</Row> | ||
</Container> | ||
) | ||
} |
Oops, something went wrong.