Skip to content

Commit

Permalink
migrate all links to WIKI_LINKS
Browse files Browse the repository at this point in the history
  • Loading branch information
notsidney committed Jul 12, 2021
1 parent f29489d commit ea336a6
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import CodeEditorHelper from "components/CodeEditorHelper";
import CodeEditor from "components/Table/editors/CodeEditor";
import FormAutosave from "./FormAutosave";
import { FieldType } from "constants/fields";
import WIKI_LINKS from "constants/wikiLinks";

const useStyles = makeStyles((theme) =>
createStyles({
Expand Down Expand Up @@ -130,7 +131,7 @@ export default function DefaultValueInput({

{config.defaultValue?.type === "dynamic" && (
<>
<CodeEditorHelper docLink="https://github.com/FiretableProject/firetable/wiki/Default-Values" />
<CodeEditorHelper docLink={WIKI_LINKS.defaultValues} />
<div className={classes.codeEditorContainer}>
<CodeEditor
height={120}
Expand Down
4 changes: 2 additions & 2 deletions www/src/components/Table/ColumnMenu/FieldSettings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import FormControlLabel from "@material-ui/core/FormControlLabel";
import Typography from "@material-ui/core/Typography";
import Divider from "@material-ui/core/Divider";
import Subheading from "components/Table/ColumnMenu/Subheading";
import WIKI_LINKS from "constants/wikiLinks";

export default function FieldSettings(props: IMenuModalProps) {
const {
Expand Down Expand Up @@ -166,8 +167,7 @@ export default function FieldSettings(props: IMenuModalProps) {
const ftBuildUrl = settingsDoc.get("ftBuildUrl");
if (!ftBuildUrl) {
snack.open({
message:
"Cloud Run trigger URL not configured. Configuration guide: https://github.com/FiretableProject/firetable/wiki/Setting-up-cloud-Run-FT-Builder",
message: `Cloud Run trigger URL not configured. Configuration guide: ${WIKI_LINKS.cloudRunFtBuilder}`,
variant: "error",
});
}
Expand Down
4 changes: 2 additions & 2 deletions www/src/components/Table/TableHeader/Sparks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { useFiretableContext } from "contexts/FiretableContext";
import { useAppContext } from "contexts/AppContext";
import { useSnackLogContext } from "contexts/SnackLogContext";
import CodeEditor from "../editors/CodeEditor";
import WIKI_LINKS from "constants/wikiLinks";

export default function SparksEditor() {
const snack = useSnackContext();
Expand Down Expand Up @@ -56,8 +57,7 @@ export default function SparksEditor() {
const ftBuildUrl = settingsDoc.get("ftBuildUrl");
if (!ftBuildUrl) {
snack.open({
message:
"Cloud Run trigger URL not configured. Configuration guide: https://github.com/FiretableProject/firetable/wiki/Setting-up-cloud-Run-FT-Builder",
message: `Cloud Run trigger URL not configured. Configuration guide: ${WIKI_LINKS.cloudRunFtBuilder}`,
variant: "error",
});
}
Expand Down
9 changes: 4 additions & 5 deletions www/src/components/Table/TableHeader/TableLogs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import Ansi from "ansi-to-react";
import EmptyState from "components/EmptyState";

import PropTypes from "prop-types";
import WIKI_LINKS from "constants/wikiLinks";

function a11yProps(index) {
return {
Expand Down Expand Up @@ -489,17 +490,15 @@ export default function TableLogs() {
message="Need Configuration"
description={
<>
Cloud Run trigger URL not configured. Configuration guide:{" "}
Cloud Run trigger URL not configured.
<Link
href={
"https://github.com/FiretableProject/firetable/wiki/Setting-up-cloud-Run-FT-Builder"
}
href={WIKI_LINKS.cloudRunFtBuilder}
target="_blank"
rel="noopener noreferrer"
variant="body2"
underline="always"
>
https://github.com/FiretableProject/firetable/wiki/Setting-up-cloud-Run-FT-Builder
Configuration guide
</Link>
</>
}
Expand Down
3 changes: 2 additions & 1 deletion www/src/components/TableSettings/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Link, Typography } from "@material-ui/core";
import OpenInNewIcon from "@material-ui/icons/OpenInNew";
import { MONO_FONT } from "Themes";
import { projectId } from "../../firebase";
import WIKI_LINKS from "constants/wikiLinks";

export const tableSettings = (
mode: TableSettingsDialogModes | null,
Expand Down Expand Up @@ -117,7 +118,7 @@ export const tableSettings = (
Choose which roles have access to this table. Remember to set the
appropriate Firestore Security Rules for this collection.
<Link
href="https://github.com/FiretableProject/firetable/wiki/Role-Based-Security-Rules"
href={WIKI_LINKS.securityRules}
target="_blank"
rel="noopener"
display="block"
Expand Down
4 changes: 3 additions & 1 deletion www/src/components/fields/Derivative/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import FieldsDropdown from "components/Table/ColumnMenu/FieldsDropdown";
import { useFiretableContext } from "contexts/FiretableContext";
import CodeEditorHelper from "components/CodeEditorHelper";

import WIKI_LINKS from "constants/wikiLinks";

const CodeEditor = lazy(
() =>
import(
Expand Down Expand Up @@ -45,7 +47,7 @@ const Settings = ({ config, handleChange }) => {
}}
/>
<Typography variant="overline">derivative script</Typography>
<CodeEditorHelper docLink="https://github.com/FiretableProject/firetable/wiki/Derivatives" />
<CodeEditorHelper docLink={WIKI_LINKS.derivatives} />
<Suspense fallback={<FieldSkeleton height={200} />}>
<CodeEditor
script={config.script}
Expand Down
18 changes: 14 additions & 4 deletions www/src/constants/wikiLinks.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
import _mapValues from "lodash/mapValues";
import meta from "../../package.json";

const WIKI_LINK_ROOT = meta.repository.url.replace(".git", "/wiki/");

export const WIKI_LINKS = {
updatingFiretable: WIKI_LINK_ROOT + "Updating-Firetable",
const WIKI_PATHS = {
updatingFiretable: "/Updating-Firetable",
derivatives: "/Derivatives",
defaultValues: "/Default-Values",
cloudRunFtBuilder: "/Setting-up-cloud-Run-FT-Builder",
securityRules: "/Role-Based-Security-Rules",
setUpAuth: "/Set-Up-Firebase-Authentication",
};

const WIKI_LINK_ROOT = meta.repository.url.replace(".git", "/wiki");

export const WIKI_LINKS = _mapValues(
WIKI_PATHS,
(path) => WIKI_LINK_ROOT + path
);
export default WIKI_LINKS;
3 changes: 2 additions & 1 deletion www/src/pages/Auth/SetupGuide.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Typography, Button } from "@material-ui/core";
import OpenInNewIcon from "@material-ui/icons/OpenInNew";

import AuthLayout from "components/Auth/AuthLayout";
import WIKI_LINKS from "constants/wikiLinks";

export default function AuthSetupGuide() {
return (
Expand All @@ -20,7 +21,7 @@ export default function AuthSetupGuide() {
variant="contained"
endIcon={<OpenInNewIcon />}
component="a"
href="https://github.com/FiretableProject/firetable/wiki/Set-Up-Firebase-Authentication"
href={WIKI_LINKS.setUpAuth}
target="_blank"
rel="noopener"
>
Expand Down
7 changes: 2 additions & 5 deletions www/src/pages/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import TableSettingsDialog, {

import ProjectSettings from "components/ProjectSettings";
import EmptyState from "components/EmptyState";
import WIKI_LINKS from "constants/wikiLinks";
const useStyles = makeStyles((theme) =>
createStyles({
"@global": {
Expand Down Expand Up @@ -155,11 +156,7 @@ export default function HomePage() {
</Typography>
<Typography variant="body2">
If you are the project owner please follow the instructions{" "}
<a
href="https://github.com/FiretableProject/firetable/wiki/Role-Based-Security-Rules"
target="_blank"
rel="noopener"
>
<a href={WIKI_LINKS.securityRules} target="_blank" rel="noopener">
here
</a>{" "}
to setup the project rules.
Expand Down

0 comments on commit ea336a6

Please sign in to comment.