Skip to content

Commit

Permalink
feat: remove view page button from header (#16)
Browse files Browse the repository at this point in the history
<img width="1529" alt="Screenshot 2024-08-09 at 10 09 12 AM"
src="https://github.com/user-attachments/assets/5a3bfe86-ce2a-47c2-8e0a-11aae25bf14f">

---------

Co-authored-by: Matt Kilpatrick <[email protected]>
Co-authored-by: Alexis Sanehisa <[email protected]>
Co-authored-by: Alexis Sanehisa <[email protected]>
  • Loading branch information
4 people authored Aug 15, 2024
1 parent 3b33631 commit ca9bef1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 33 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@
"@typescript-eslint/eslint-plugin": "^8.0.1",
"@typescript-eslint/parser": "^8.0.1",
"@vitejs/plugin-react": "^4.3.1",
"@yext/pages": "1.2.0-beta.0",
"autoprefixer": "^10.4.19",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-require-extensions": "^0.1.3",
Expand Down
3 changes: 0 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 14 additions & 17 deletions src/components/Editor.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { InternalEditor } from "../internal/components/InternalEditor.js";
import "./index.css";
import { DocumentProvider } from "@yext/pages/util";
import React, { useEffect, useState, useCallback, useRef } from "react";
import { LoadingScreen } from "../internal/puck/components/LoadingScreen.tsx";
import { Toaster } from "../internal/puck/ui/Toaster.tsx";
Expand Down Expand Up @@ -367,22 +366,20 @@ export const Editor = ({ document, puckConfigs }: EditorProps) => {
return (
<>
{!isLoading ? (
<DocumentProvider value={document}>
<InternalEditor
puckConfig={puckConfig}
isLoading={isLoading}
puckInitialHistory={puckInitialHistory}
clearHistory={
templateMetadata?.isDevMode ? clearLocalStorage : clearHistory
}
templateMetadata={templateMetadata}
saveState={saveState!}
saveSaveState={saveSaveState}
saveVisualConfigData={saveVisualConfigData}
sendDevSaveStateData={sendDevSaveStateData}
visualConfigurationData={visualConfigurationData}
/>
</DocumentProvider>
<InternalEditor
puckConfig={puckConfig}
isLoading={isLoading}
puckInitialHistory={puckInitialHistory}
clearHistory={
templateMetadata?.isDevMode ? clearLocalStorage : clearHistory
}
templateMetadata={templateMetadata}
saveState={saveState!}
saveSaveState={saveSaveState}
saveVisualConfigData={saveVisualConfigData}
sendDevSaveStateData={sendDevSaveStateData}
visualConfigurationData={visualConfigurationData}
/>
) : (
parentLoaded && <LoadingScreen progress={progress} />
)}
Expand Down
12 changes: 0 additions & 12 deletions src/internal/puck/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
AlertDialogTrigger,
} from "../ui/AlertDialog.tsx";
import { useCallback, useEffect } from "react";
import { useDocument } from "@yext/pages/util";
import { Button } from "../ui/button.tsx";
import { Switch } from "../ui/switch.tsx";
import { useEntityField } from "../../../components/EntityField.tsx";
Expand All @@ -26,10 +25,6 @@ import {
} from "../ui/Tooltip.tsx";
import "../../../components/index.css";

const handleClick = (slug: string) => {
window.open(`/${slug}`, "_blank");
};

export const customHeader = (
handleClearLocalChanges: () => void,
handleHistoryChange: (histories: History[], index: number) => void,
Expand All @@ -38,7 +33,6 @@ export const customHeader = (
handleSaveData: (data: Data) => Promise<void>,
isDevMode: boolean
) => {
const entityDocument = useDocument<any>();
const {
dispatch: puckDispatch,
history: { back, forward, histories, index, hasFuture, setHistories },
Expand Down Expand Up @@ -83,12 +77,6 @@ export const customHeader = (
});
}}
/>
<Button
variant="outline"
onClick={() => handleClick(entityDocument.slug)}
>
View Page
</Button>
{!isDevMode && (
<Button
variant="secondary"
Expand Down

0 comments on commit ca9bef1

Please sign in to comment.