Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexVanderbist committed Dec 30, 2021
1 parent f901086 commit 1020258
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 19 deletions.
26 changes: 23 additions & 3 deletions resources/compiled/ignition.js
Original file line number Diff line number Diff line change
Expand Up @@ -20616,6 +20616,26 @@ function jsonStringify(value) {
return JSON.stringify(value, null, 4);
}

function hasDebugInfo(errorOccurrence) {
if (errorOccurrence.glows.length) {
return true;
}

if (errorOccurrence.context_items.dumps.length) {
return true;
}

if (errorOccurrence.context_items.logs.length) {
return true;
}

if (errorOccurrence.context_items.queries.length) {
return true;
}

return false;
}

function CodeSnippet(_ref15) {
var value = _ref15.value,
_ref15$limitHeight = _ref15.limitHeight,
Expand Down Expand Up @@ -25091,10 +25111,10 @@ function NavBar(_ref) {
}), react.createElement(NavBarItem, {
name: "context",
icon: "fas fa-info-circle"
}), react.createElement(NavBarItem, {
}), hasDebugInfo(errorOccurrence) && react.createElement(NavBarItem, {
name: "debug",
icon: "fas fa-info-bug",
important: true
important: !!errorOccurrence.context_items.dumps.length
}), react.createElement(NavBarItem, {
name: "share",
icon: "fas fa-share",
Expand Down Expand Up @@ -25412,7 +25432,7 @@ function Ignition(_ref) {
}), react.createElement(Section, {
name: "context",
children: react.createElement(Context, null)
}), react.createElement(Section, {
}), hasDebugInfo(errorOccurrence) && react.createElement(Section, {
name: "debug",
children: react.createElement(Debug, null)
}))))));
Expand Down
15 changes: 13 additions & 2 deletions resources/js/Ignition.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,16 @@ import InViewContextProvider from 'contexts/InViewContextProvider';
import NavBar from 'components/NavBar';
import Section from 'components/Section';
import { IgniteDataContext } from 'contexts/IgniteDataContext';
import { ErrorOccurrence, StackTrace, Context, Debug, ErrorOccurrenceContext, ErrorCard, IgnitionConfigContextProvider } from '@flareapp/ignition-ui';
import {
ErrorOccurrence,
StackTrace,
Context,
Debug,
ErrorOccurrenceContext,
ErrorCard,
IgnitionConfigContextProvider,
hasDebugInfo,
} from '@flareapp/ignition-ui';
import { IgniteData } from './types';
import { useInView } from 'react-intersection-observer';

Expand Down Expand Up @@ -37,7 +46,9 @@ export default function Ignition({ errorOccurrence, igniteData }: Props) {

<Section name="context" children={<Context />} />

<Section name="debug" children={<Debug />} />
{hasDebugInfo(errorOccurrence) && (
<Section name="debug" children={<Debug />} />
)}
</main>
</InViewContextProvider>
</ErrorOccurrenceContext.Provider>
Expand Down
32 changes: 18 additions & 14 deletions resources/js/components/NavBar.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import React, {useContext, useState} from 'react';
import React, { useContext, useState } from 'react';
import NavBarItem from 'components/NavBarItem';
import ShareDropdown from 'components/ShareDropdown';
import SettingsDropdown from 'components/SettingsDropdown';
import {ErrorOccurrenceContext} from '@flareapp/ignition-ui';
import useHasScrolled from "hooks/useHasScrolled";
import { ErrorOccurrenceContext, hasDebugInfo } from '@flareapp/ignition-ui';
import useHasScrolled from 'hooks/useHasScrolled';

type Props = { showException: boolean };

export default function NavBar({showException}: Props) {
export default function NavBar({ showException }: Props) {
const errorOccurrence = useContext(ErrorOccurrenceContext);
const [isShareDropdownOpen, setIsShareDropdownOpen] = useState(false);
const [isSettingsDropdownOpen, setIsSettingsDropdownOpen] = useState(false);
const hasScrolled = useHasScrolled({distance: 10});
const hasScrolled = useHasScrolled({ distance: 10 });

function toggleShare() {
setIsSettingsDropdownOpen(false);
Expand All @@ -32,21 +32,25 @@ export default function NavBar({showException}: Props) {
z-10 transform translate-x-0 transition-color duration-100
`}
>
<div
className="h-10 flex justify-between px-6 lg:px-10 2xl:px-20 mx-auto max-w-4xl lg:max-w-[90rem] 2xl:max-w-none"
>
<div className="h-10 flex justify-between px-6 lg:px-10 2xl:px-20 mx-auto max-w-4xl lg:max-w-[90rem] 2xl:max-w-none">
<ul className="-ml-3 sm:-ml-5 grid grid-flow-col justify-start items-center">
<NavBarItem name="stack" icon="fas fa-code"/>
<NavBarItem name="context" icon="fas fa-info-circle"/>
<NavBarItem name="debug" icon="fas fa-info-bug" important/>
<NavBarItem name="stack" icon="fas fa-code" />
<NavBarItem name="context" icon="fas fa-info-circle" />
{hasDebugInfo(errorOccurrence) && (
<NavBarItem
name="debug"
icon="fas fa-info-bug"
important={!!errorOccurrence.context_items.dumps.length}
/>
)}
<NavBarItem name="share" icon="fas fa-share" onClick={toggleShare}>
<ShareDropdown isOpen={isShareDropdownOpen}/>
<ShareDropdown isOpen={isShareDropdownOpen} />
</NavBarItem>
</ul>
<ul className="-mr-3 sm:-mr-5 grid grid-flow-col justify-end items-center">
<NavBarItem name="docs" href="https://laravel.com/docs" icon="fab fa-laravel" important/>
<NavBarItem name="docs" href="https://laravel.com/docs" icon="fab fa-laravel" important />
<NavBarItem name="settings" icon="fas fa-cog" label={false} onClick={toggleSettings}>
<SettingsDropdown isOpen={isSettingsDropdownOpen}/>
<SettingsDropdown isOpen={isSettingsDropdownOpen} />
</NavBarItem>

{/* <li class="flex items-center">
Expand Down

0 comments on commit 1020258

Please sign in to comment.