web: edit report and edit dashboard
This commit is contained in:
@@ -27,7 +27,9 @@ export function NavbarMenu() {
|
||||
return (
|
||||
<div className={cn('flex gap-1 items-center text-sm', 'max-sm:flex-col')}>
|
||||
{params.project && (
|
||||
<Item href={`/${params.organization}/${params.project}`}>Home</Item>
|
||||
<Item href={`/${params.organization}/${params.project}`}>
|
||||
Dashboards
|
||||
</Item>
|
||||
)}
|
||||
{params.project && (
|
||||
<Item href={`/${params.organization}/${params.project}/events`}>
|
||||
|
||||
@@ -47,7 +47,7 @@ export const Chart = memo(
|
||||
if (!enabled) {
|
||||
return (
|
||||
<ChartAnimationContainer>
|
||||
<ChartAnimation name="ballon" className="w-96 mx-auto" />
|
||||
<ChartAnimation name="ballon" className="max-w-sm w-fill mx-auto" />
|
||||
<p className="text-center font-medium">
|
||||
Please select at least one event to see the chart.
|
||||
</p>
|
||||
@@ -58,7 +58,7 @@ export const Chart = memo(
|
||||
if (chart.isFetching) {
|
||||
return (
|
||||
<ChartAnimationContainer>
|
||||
<ChartAnimation name="airplane" className="w-96 mx-auto" />
|
||||
<ChartAnimation name="airplane" className="max-w-sm w-fill mx-auto" />
|
||||
<p className="text-center font-medium">Loading...</p>
|
||||
</ChartAnimationContainer>
|
||||
);
|
||||
@@ -67,20 +67,22 @@ export const Chart = memo(
|
||||
if (chart.isError) {
|
||||
return (
|
||||
<ChartAnimationContainer>
|
||||
<ChartAnimation name="noData" className="w-96 mx-auto" />
|
||||
<ChartAnimation name="noData" className="max-w-sm w-fill mx-auto" />
|
||||
<p className="text-center font-medium">Something went wrong...</p>
|
||||
</ChartAnimationContainer>
|
||||
);
|
||||
}
|
||||
|
||||
if (!chart.isSuccess) {
|
||||
return <ChartAnimation name="ballon" className="w-96 mx-auto" />;
|
||||
return (
|
||||
<ChartAnimation name="ballon" className="max-w-sm w-fill mx-auto" />
|
||||
);
|
||||
}
|
||||
|
||||
if (!anyData) {
|
||||
return (
|
||||
<ChartAnimationContainer>
|
||||
<ChartAnimation name="noData" className="w-96 mx-auto" />
|
||||
<ChartAnimation name="noData" className="max-w-sm w-fill mx-auto" />
|
||||
<p className="text-center font-medium">No data</p>
|
||||
</ChartAnimationContainer>
|
||||
);
|
||||
@@ -96,7 +98,7 @@ export const Chart = memo(
|
||||
|
||||
return (
|
||||
<ChartAnimationContainer>
|
||||
<ChartAnimation name="ballon" className="w-96 mx-auto" />
|
||||
<ChartAnimation name="ballon" className="max-w-sm w-fill mx-auto" />
|
||||
<p className="text-center font-medium">
|
||||
Chart type "{chartType}" is not supported yet.
|
||||
</p>
|
||||
|
||||
@@ -19,7 +19,7 @@ type InitialState = IChartInput & {
|
||||
// First approach: define the initial state using that type
|
||||
const initialState: InitialState = {
|
||||
dirty: false,
|
||||
name: 'screen_view',
|
||||
name: 'Untitled',
|
||||
chartType: 'linear',
|
||||
interval: 'day',
|
||||
breakdowns: [],
|
||||
@@ -30,7 +30,7 @@ const initialState: InitialState = {
|
||||
};
|
||||
|
||||
export const reportSlice = createSlice({
|
||||
name: 'counter',
|
||||
name: 'report',
|
||||
initialState,
|
||||
reducers: {
|
||||
resetDirty(state) {
|
||||
@@ -50,6 +50,10 @@ export const reportSlice = createSlice({
|
||||
dirty: false,
|
||||
};
|
||||
},
|
||||
setName(state, action: PayloadAction<string>) {
|
||||
state.dirty = true;
|
||||
state.name = action.payload;
|
||||
},
|
||||
// Events
|
||||
addEvent: (state, action: PayloadAction<Omit<IChartEvent, 'id'>>) => {
|
||||
state.dirty = true;
|
||||
@@ -162,6 +166,7 @@ export const reportSlice = createSlice({
|
||||
export const {
|
||||
reset,
|
||||
setReport,
|
||||
setName,
|
||||
addEvent,
|
||||
removeEvent,
|
||||
changeEvent,
|
||||
|
||||
Reference in New Issue
Block a user