Skip to content

Commit

Permalink
Merge pull request #763 from CodeForAfrica/bugfix/762-robots-generato…
Browse files Browse the repository at this point in the history
…r-form

@/Roboshield Robots Generator form
  • Loading branch information
koechkevin committed Jul 10, 2024
2 parents a58fa18 + 81e0fcb commit e1797d7
Show file tree
Hide file tree
Showing 21 changed files with 150 additions and 180 deletions.
6 changes: 3 additions & 3 deletions apps/roboshield/payload-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export interface Page {
blockType: "statistics";
}
| {
toolTipText: string;
showRobotsTxt: string;
steps?:
| (
| {
Expand All @@ -125,7 +125,7 @@ export interface Page {
fetch: string;
id?: string | null;
blockName?: string | null;
blockType: "existing-robots";
blockType: "existing-robots-txt";
}
| {
title: string;
Expand Down Expand Up @@ -227,7 +227,7 @@ export interface Page {
};
id?: string | null;
blockName?: string | null;
blockType: "robo-form";
blockType: "robots-txt-generator";
}
)[]
| null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Content from "@/roboshield/components/Content";
import Statistics from "@/roboshield/components/Statistics";
import { Page } from "@/root/payload-types";
import Hero from "@/roboshield/components/Hero";
import RoboForm from "@/roboshield/components/RoboForm";
import RobotsTxtGenerator from "@/roboshield/components/RobotsTxtGenerator";
import { FC } from "react";

interface BlockRendererProps extends Pick<Page, "blocks"> {}
Expand All @@ -13,7 +13,7 @@ const components = {
"page-hero": Hero,
content: Content,
statistics: Statistics,
"robo-form": RoboForm,
"robots-txt-generator": RobotsTxtGenerator,
};

export default function BlockRenderer({ blocks }: BlockRendererProps) {
Expand Down
7 changes: 3 additions & 4 deletions apps/roboshield/src/components/CommonBots/CommonBots.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ export default function CommonBots({
handleSkipToLast,
hint,
lastStep,
globalLabels,
toolTipText,
actions,
}: StepComponent) {
const { state } = useGlobalState();

Expand Down Expand Up @@ -88,7 +87,7 @@ export default function CommonBots({
<SkipToLastStep
handleSkipToLast={skipToLast}
lastStep={lastStep}
toolTipText={toolTipText}
showRobotsTxt={actions?.showRobotsTxt}
/>
<StepHint hint={hint} />
<Box sx={{ py: 2 }}>
Expand Down Expand Up @@ -223,7 +222,7 @@ export default function CommonBots({
isValid={true}
lastStep={lastStep}
back={false}
labels={globalLabels}
labels={actions}
/>
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,10 @@ export default function CommonSettings({
handleSkipToLast,
hint,
lastStep,
globalLabels,
actions,
selectPlatform,
allowedPaths: allowedPathsLabel,
disallowedPaths: disallowedPathsLabel,
toolTipText,
}: Props) {
const { state } = useGlobalState();

Expand Down Expand Up @@ -97,7 +96,7 @@ export default function CommonSettings({
<SkipToLastStep
handleSkipToLast={skipToLast}
lastStep={lastStep}
toolTipText={toolTipText}
showRobotsTxt={actions?.showRobotsTxt}
/>
<StepHint hint={hint} />
<Box
Expand Down Expand Up @@ -221,7 +220,7 @@ export default function CommonSettings({
isValid={true}
lastStep={lastStep}
back={false}
labels={globalLabels}
labels={actions}
/>
</>
);
Expand Down
7 changes: 3 additions & 4 deletions apps/roboshield/src/components/Delays/Delays.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ export default function Delays({
handleSkipToLast,
hint,
lastStep,
globalLabels,
actions,
cacheDelay: cachedDelayLabel,
crawlDelay: crawlDelayLabel,
visitTime: visitTimeLabel,
toolTipText,
}: Props) {
const { state } = useGlobalState();

Expand Down Expand Up @@ -85,7 +84,7 @@ export default function Delays({
<SkipToLastStep
handleSkipToLast={skipToLast}
lastStep={lastStep}
toolTipText={toolTipText}
showRobotsTxt={actions?.showRobotsTxt}
/>
<StepHint hint={hint} />
<Box
Expand Down Expand Up @@ -191,7 +190,7 @@ export default function Delays({
isValid={true}
lastStep={lastStep}
back={false}
labels={globalLabels}
labels={actions}
/>
</>
);
Expand Down
3 changes: 0 additions & 3 deletions apps/roboshield/src/components/ExistingRobots/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ interface Props extends StepComponent {
export default function ExistingRobots({
existingRobotsTxt,
fetch: fetchLabel,
globalLabels,
actions,
handleNext,
handleBack,
handleSkipToLast,
Expand All @@ -32,7 +32,6 @@ export default function ExistingRobots({
placeholder,
urlValidationError,
defaultFetchExistingRobots,
toolTipText,
}: Props) {
const { state } = useGlobalState();
const [url, setUrl] = useState(state.url);
Expand Down Expand Up @@ -102,7 +101,7 @@ export default function ExistingRobots({
<SkipToLastStep
handleSkipToLast={skipToLast}
lastStep={lastStep}
toolTipText={toolTipText}
showRobotsTxt={actions?.showRobotsTxt}
/>
<StepHint hint={hint} />
<Box sx={{ py: 2 }}>
Expand Down Expand Up @@ -170,7 +169,7 @@ export default function ExistingRobots({
isValid={allowNextStep || !shouldFetch}
lastStep={lastStep}
back={true}
labels={globalLabels}
labels={actions}
/>
<Snackbar
open={robotsError}
Expand Down
3 changes: 3 additions & 0 deletions apps/roboshield/src/components/ExistingRobotsTxt/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import ExistingRobotsTxt from "./ExistingRobotsTxt";

export default ExistingRobotsTxt;
9 changes: 4 additions & 5 deletions apps/roboshield/src/components/Finish/Finish.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ export default function Finish({
handleBack,
hint,
lastStep,
globalLabels,
toolTipText,
actions,
}: Props) {
const { state } = useGlobalState();
const [code, setCode] = useState(state.robots || "");
Expand Down Expand Up @@ -80,7 +79,7 @@ export default function Finish({
<SkipToLastStep
handleSkipToLast={() => {}}
lastStep={lastStep}
toolTipText={toolTipText}
showRobotsTxt={actions?.showRobotsTxt}
/>
<StepHint hint={hint} />
<Box
Expand All @@ -98,7 +97,7 @@ export default function Finish({
onBack={handleBack}
showButtons={true}
onCodeChange={handleCodeChange}
labels={globalLabels}
labels={actions}
/>
</Box>
<StepperNav
Expand All @@ -107,7 +106,7 @@ export default function Finish({
isValid={true}
lastStep={true}
back={false}
labels={globalLabels}
labels={actions}
/>
<Snackbar
open={showSnackbar}
Expand Down
2 changes: 1 addition & 1 deletion apps/roboshield/src/components/Hero/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const Hero = (props: PageHero) => {

<Button
onClick={() => {
const element = document.getElementById("robots-generator");
const element = document.getElementById("robots-txt-generator");
element?.scrollIntoView({
behavior: "smooth",
});
Expand Down
3 changes: 0 additions & 3 deletions apps/roboshield/src/components/RoboForm/index.ts

This file was deleted.

Loading

0 comments on commit e1797d7

Please sign in to comment.