Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Disable toolbar in touch device #419

Merged
merged 1 commit into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions app/src/@shared/components/Chart/hooks/useDefaultOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useAtomValue } from 'jotai';
import { merge } from 'lodash-es';

import { Palette, paletteAtom } from '@shared/atoms/paletteAtom';
import { BREAKPOINT } from '@shared/constants/responsive';

export const useDefaultOptions = () => {
const palette = useAtomValue(paletteAtom);
Expand Down Expand Up @@ -37,6 +38,9 @@ const defaultOptions: ApexCharts.ApexOptions = {
},
autoSelected: 'pan',
},
zoom: {
enabled: true,
},
fontFamily:
"'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, system-ui, Roboto, 'Helvetica Neue', 'Segoe UI', 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', sans-serif",
},
Expand All @@ -54,6 +58,21 @@ const defaultOptions: ApexCharts.ApexOptions = {
},
},
},
responsive: [
{
breakpoint: BREAKPOINT.TABLET,
options: {
chart: {
toolbar: {
show: false,
},
zoom: {
enabled: false,
},
},
},
},
],
};

export const defaultLightOptions = defaultOptions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ import {
CALENDAR_MONTHS_FROM_FT_BEGIN_AT,
MILLISECONDS,
} from '@shared/constants/date';
import { BREAKPOINT } from '@shared/constants/responsive';
import { kiloFormatter } from '@shared/utils/formatters/kiloFormatter';
import { numberWithUnitFormatter } from '@shared/utils/formatters/numberWithUnitFormatter';
import { injectEmptyMonth } from '@shared/utils/injectEmptyMonth';
import { useDeviceType } from '@shared/utils/react-responsive/useDeviceType';

const GET_SCORE_RECORDS_PER_COALITION = gql(/* GraphQL */ `
query GetScoreRecordsPerCoalition($last: Int!) {
Expand All @@ -35,7 +37,10 @@ const GET_SCORE_RECORDS_PER_COALITION = gql(/* GraphQL */ `

export const ScoreRecordsPerCoalition = () => {
const title = '코알리숑 스코어 변동 추이';
const last = CALENDAR_MONTHS_FROM_FT_BEGIN_AT + 1;

const device = useDeviceType();
const isDesktop = device === 'desktop';
const last = isDesktop ? CALENDAR_MONTHS_FROM_FT_BEGIN_AT + 1 : 8;

const { loading, error, data } = useQuery(GET_SCORE_RECORDS_PER_COALITION, {
variables: {
Expand Down Expand Up @@ -143,6 +148,8 @@ const ScoreRecordsPerCoalitionChart = ({
formatter: (value) => kiloFormatter(value, 0),
},
tickAmount: 4,
min,
max,
},
tooltip: {
x: {
Expand All @@ -155,6 +162,22 @@ const ScoreRecordsPerCoalitionChart = ({
forecastDataPoints: {
count: 1,
},
responsive: [
{
breakpoint: BREAKPOINT.TABLET,
options: {
chart: {
event: {
beforeZoom: undefined,
beforeResetZoom: undefined,
},
},
xaxis: {
min: undefined,
},
},
},
],
};

return <LineChart series={series} options={options} />;
Expand Down
23 changes: 22 additions & 1 deletion app/src/Home/dashboard-contents/Eval/EvalCountRecords.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ import {
DashboardContentNotFound,
} from '@shared/components/DashboardContentView/Error';
import { MILLISECONDS } from '@shared/constants/date';
import { BREAKPOINT } from '@shared/constants/responsive';
import { numberWithUnitFormatter } from '@shared/utils/formatters/numberWithUnitFormatter';
import { injectEmptyDay } from '@shared/utils/injectEmptyDay';
import { useDeviceType } from '@shared/utils/react-responsive/useDeviceType';

const GET_EVAL_COUNT_RECORDS = gql(/* GraphQL */ `
query GetEvalCountRecords($last: Int!) {
Expand All @@ -26,7 +28,10 @@ const GET_EVAL_COUNT_RECORDS = gql(/* GraphQL */ `

export const EvalCountRecords = () => {
const title = '일간 평가 횟수 추이';
const last = 365;

const device = useDeviceType();
const isDesktop = device === 'desktop';
const last = isDesktop ? 365 : 30;

const { loading, error, data } = useQuery(GET_EVAL_COUNT_RECORDS, {
variables: {
Expand Down Expand Up @@ -122,6 +127,22 @@ const EvalCountRecordsChart = ({ series }: EvalCountRecordsChartProps) => {
forecastDataPoints: {
count: 1,
},
responsive: [
{
breakpoint: BREAKPOINT.TABLET,
options: {
chart: {
event: {
beforeZoom: undefined,
beforeResetZoom: undefined,
},
},
xaxis: {
min: undefined,
},
},
},
],
};
return <AreaChart series={series} options={options} />;
};
23 changes: 22 additions & 1 deletion app/src/Home/dashboard-contents/Team/TeamCloseRecords.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ import {
DashboardContentNotFound,
} from '@shared/components/DashboardContentView/Error';
import { MILLISECONDS } from '@shared/constants/date';
import { BREAKPOINT } from '@shared/constants/responsive';
import { numberWithUnitFormatter } from '@shared/utils/formatters/numberWithUnitFormatter';
import { injectEmptyDay } from '@shared/utils/injectEmptyDay';
import { useDeviceType } from '@shared/utils/react-responsive/useDeviceType';

const GET_TEAM_CLOSE_RECORDS = gql(/* GraphQL */ `
query GetTeamCloseRecords($last: Int!) {
Expand All @@ -26,7 +28,10 @@ const GET_TEAM_CLOSE_RECORDS = gql(/* GraphQL */ `

export const TeamCloseRecords = () => {
const title = '일간 팀 제출 횟수 추이';
const last = 365;

const device = useDeviceType();
const isDesktop = device === 'desktop';
const last = isDesktop ? 365 : 30;

const { loading, error, data } = useQuery(GET_TEAM_CLOSE_RECORDS, {
variables: {
Expand Down Expand Up @@ -122,6 +127,22 @@ const EvalCountRecordsChart = ({ series }: EvalCountRecordsChartProps) => {
forecastDataPoints: {
count: 1,
},
responsive: [
{
breakpoint: BREAKPOINT.TABLET,
options: {
chart: {
event: {
beforeZoom: undefined,
beforeResetZoom: undefined,
},
},
xaxis: {
min: undefined,
},
},
},
],
};
return <AreaChart series={series} options={options} />;
};
23 changes: 22 additions & 1 deletion app/src/Home/dashboard-contents/User/BlackholedCountRecords.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ import {
CALENDAR_MONTHS_FROM_FT_BEGIN_AT,
MILLISECONDS,
} from '@shared/constants/date';
import { BREAKPOINT } from '@shared/constants/responsive';
import { numberWithUnitFormatter } from '@shared/utils/formatters/numberWithUnitFormatter';
import { injectEmptyMonth } from '@shared/utils/injectEmptyMonth';
import { useDeviceType } from '@shared/utils/react-responsive/useDeviceType';

const GET_BLACKHOLED_COUNT_RECORDS = gql(/* GraphQL */ `
query GetBlackholedCountRecords($last: Int!) {
Expand All @@ -29,7 +31,10 @@ const GET_BLACKHOLED_COUNT_RECORDS = gql(/* GraphQL */ `

export const BlackholedCountRecords = () => {
const title = '월간 블랙홀 인원 추이';
const last = CALENDAR_MONTHS_FROM_FT_BEGIN_AT + 1;

const device = useDeviceType();
const isDesktop = device === 'desktop';
const last = isDesktop ? CALENDAR_MONTHS_FROM_FT_BEGIN_AT + 1 : 12;

const { loading, error, data } = useQuery(GET_BLACKHOLED_COUNT_RECORDS, {
variables: {
Expand Down Expand Up @@ -129,6 +134,22 @@ const BlackholedCountRecordsChart = ({
forecastDataPoints: {
count: 1,
},
responsive: [
{
breakpoint: BREAKPOINT.TABLET,
options: {
chart: {
event: {
beforeZoom: undefined,
beforeResetZoom: undefined,
},
},
xaxis: {
min: undefined,
},
},
},
],
};
return <AreaChart series={series} options={options} />;
};
25 changes: 24 additions & 1 deletion app/src/Profile/dashboard-contents/Eval/CountRecords.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ import {
DashboardContentNotFound,
} from '@shared/components/DashboardContentView/Error';
import { MILLISECONDS } from '@shared/constants/date';
import { BREAKPOINT } from '@shared/constants/responsive';
import { numberWithUnitFormatter } from '@shared/utils/formatters/numberWithUnitFormatter';
import { injectEmptyMonth } from '@shared/utils/injectEmptyMonth';
import { useDeviceType } from '@shared/utils/react-responsive/useDeviceType';

const GET_COUNT_RECORDS_BY_LOGIN = gql(/* GraphQL */ `
query GetCountRecordsByLogin($login: String!, $last: Int!) {
Expand All @@ -30,7 +32,12 @@ const GET_COUNT_RECORDS_BY_LOGIN = gql(/* GraphQL */ `
export const CountRecords = () => {
const { login } = useContext(UserProfileContext);
const beginAt = useContext(BeginAtContext);
const last = differenceInCalendarMonths(new Date(), beginAt) + 1;

const device = useDeviceType();
const isDesktop = device === 'desktop';
const last = isDesktop
? differenceInCalendarMonths(new Date(), beginAt) + 1
: Math.min(differenceInCalendarMonths(new Date(), beginAt) + 1, 12);

const title = '월간 평가 횟수 추이';
const { loading, error, data } = useQuery(GET_COUNT_RECORDS_BY_LOGIN, {
Expand Down Expand Up @@ -135,6 +142,22 @@ const CountRecordsChart = ({ series }: CountRecordsChartProps) => {
forecastDataPoints: {
count: 1,
},
responsive: [
{
breakpoint: BREAKPOINT.TABLET,
options: {
chart: {
event: {
beforeZoom: undefined,
beforeResetZoom: undefined,
},
},
xaxis: {
min: undefined,
},
},
},
],
};
return <AreaChart series={series} options={options} />;
};
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ import {
DashboardContentNotFound,
} from '@shared/components/DashboardContentView/Error';
import { MILLISECONDS } from '@shared/constants/date';
import { BREAKPOINT } from '@shared/constants/responsive';
import { numberWithUnitFormatter } from '@shared/utils/formatters/numberWithUnitFormatter';
import { injectEmptyMonth } from '@shared/utils/injectEmptyMonth';
import { useDeviceType } from '@shared/utils/react-responsive/useDeviceType';

const GET_LOGTIME_RECORDS_BY_LOGIN = gql(/* GraphQL */ `
query GetLogtimeRecords($login: String!, $last: Int!) {
Expand All @@ -30,7 +32,12 @@ const GET_LOGTIME_RECORDS_BY_LOGIN = gql(/* GraphQL */ `
export const LogtimeRecords = () => {
const { login } = useContext(UserProfileContext);
const beginAt = useContext(BeginAtContext);
const last = differenceInCalendarMonths(new Date(), beginAt) + 1;

const device = useDeviceType();
const isDesktop = device === 'desktop';
const last = isDesktop
? differenceInCalendarMonths(new Date(), beginAt) + 1
: Math.min(differenceInCalendarMonths(new Date(), beginAt) + 1, 12);

const title = '월간 접속 시간 추이';
const { loading, error, data } = useQuery(GET_LOGTIME_RECORDS_BY_LOGIN, {
Expand Down Expand Up @@ -144,6 +151,22 @@ const LogtimeRecordsChart = ({ series }: LogtimeRecordsChartProps) => {
forecastDataPoints: {
count: 1,
},
responsive: [
{
breakpoint: BREAKPOINT.TABLET,
options: {
chart: {
event: {
beforeZoom: undefined,
beforeResetZoom: undefined,
},
},
xaxis: {
min: undefined,
},
},
},
],
};
return <AreaChart series={series} options={options} />;
};