Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

month view not workink #3

Open
josecn29 opened this issue Jul 9, 2019 · 9 comments
Open

month view not workink #3

josecn29 opened this issue Jul 9, 2019 · 9 comments
Labels
Question Further information is requested

Comments

@josecn29
Copy link

josecn29 commented Jul 9, 2019

Version

"@toast-ui/react-calendar": "^1.0.1"

Test Environment

Goolgle Chrome Versión 75.0.3770.100 Windows

Current Behavior

When I switch to the month view, it is not displayed correctly. Only the headers are shown.

In others views, it is displayed correctly.

import * as React from 'react';
import Typography from '@material-ui/core/Typography';
import { Link } from 'react-router-dom';
import { linkRoutes } from 'core/router';
import { useTranslation, composeInitialProps } from 'react-i18next';
import { namespaces } from 'core/i18n';
import { keys } from './translations';
import Calendar from '@toast-ui/react-calendar';
import Button from '@material-ui/core/Button';
import { makeStyles } from '@material-ui/core/styles';
import moment from 'moment';

interface Props {
  schedules: any;
}

const useStyles = makeStyles(theme => ({
  button: {
    margin: theme.spacing(1),
  },
  input: {
    display: 'none',
  },
}));

export const HorarioComponent: React.FunctionComponent<Props> = props => {

  const classes = useStyles(props);
  const { t } = useTranslation(namespaces.pods.horario);

  const [view, setView] = React.useState('day');

  const myTheme = {
    // Theme object to extends default dark theme.
  };

  function handleDiaClick(e) {
    e.preventDefault();
    setView('day');
  }

  function handleSemanaClick(e) {
    e.preventDefault();
    setView('week');
  }

  function handleMesClick(e) {
    e.preventDefault();
    setView('month');
  }



  return (
    <>
      <Typography variant="h4">{t(keys.title)}</Typography>
      <Link to={linkRoutes.base}>
        <Typography variant="body1">{t(keys.link)}</Typography>
      </Link>
      <div id="botones" style={{ width: '100%' }}>
        <Button
          variant="contained"
          className={classes.button}
          onClick={handleDiaClick}
        >
          Dia
        </Button>
        <Button
          variant="contained"
          className={classes.button}
          onClick={handleSemanaClick}
        >
          Semana
        </Button>
        <Button
          variant="contained"
          className={classes.button}
          onClick={handleMesClick}
        >
          Mes
        </Button>
      </div>
      <div id="calendar" style={{ width: '100%' }}>
        <Calendar
          calendars={[
            {
              id: '0',
              name: 'Asignatura 1',
              bgColor: '#9e5fff',
              borderColor: '#9e5fff',
            },
            {
              id: '1',
              name: 'Asignatura 2',
              bgColor: '#00a9ff',
              borderColor: '#00a9ff',
            },
          ]}
          view={view}
          disableDblClick={true}
          disableClick={true}
          height="100%"
          isReadOnly={true}
          month={{
            daynames: ['Dom', 'Lun', 'Mar', 'Mie', 'Jue', 'Vie', 'Sab'],
            startDayOfWeek: 1,
            visibleWeeksCount: 6,
          }}
          schedules={props.schedules}
          scheduleView={true}
          taskView={false}
          template={{
            milestone(schedule) {
              return `<span style="color:#fff;background-color: ${schedule.bgColor};">${schedule.title}</span>`;
            },
            milestoneTitle() {
              return 'Milestone';
            },
            allday(schedule) {
              return `${schedule.title}<i class="fa fa-refresh"></i>`;
            },
            alldayTitle() {
              return 'Todo el dia';
            },
          }}
          theme={myTheme}
          /*   timezones={[
            {
              timezoneOffset: 540,
              displayLabel: 'GMT+01:00',
              tooltip: 'Madrid',
            },
          ]} */
          useDetailPopup
          useCreationPopup
          //    view={selectedView}
          week={{
            startDayOfWeek: 1,
            daynames: ['Dom', 'Lun', 'Mar', 'Mie', 'Jue', 'Vie', 'Sab'],
            showTimezoneCollapseButton: true,
            timezonesCollapsed: true,
            hourStart: 8,
            hourEnd: 18,
          }}
        />
      </div>
    </>
  );
};

2019-07-09_22-28-54

Expected Behavior

I would like to see the month view

@dongsik-yoo
Copy link
Contributor

#calendar must have css height. Will you set the height?

@josecn29
Copy link
Author

But both day and week views work correctly without height. This one should also do it.
How workaround is perfect.

@dongsik-yoo
Copy link
Contributor

@josecn29 yeah, you're right. I will enhance that.

@josecn29
Copy link
Author

Ok, thanks. I await the solution.

@jungeun-cho jungeun-cho added the Question Further information is requested label Jul 12, 2019
@zzis
Copy link

zzis commented Jul 18, 2019

+1, waiting for the solution

@zzis
Copy link

zzis commented Jul 18, 2019

I'm using the container has a height, but still can't see the calendar. With version 1.0.2

<div id={'calendar'} style={{height: 500, width: '100%'}}>
  <Calendar
    view={'month'}
  />
</div>;

image

@zzis
Copy link

zzis commented Jul 18, 2019

#calendar must have css height. Will you set the height?

I checked the code, the height prop should be the Calendar itself but not the container's height
image
now it works, I can see the month view after setting the height prop

<div id={'calendar'} className={style.calendarContainer}>
  <Calendar
     view={'month'}
     height={500}
  />
</div>;

@dongsik-yoo
Copy link
Contributor

Thank you. And I patch this at TOAST UI Calendar. You will see the default height of month view after new release version(Not scheduled).

@adhrinae
Copy link
Contributor

@Elise-Kasai
Hi, I think your question is irrelevant to this issue.
How about creating a new issue on the main repo? It will help others struggling with similar problems.
And also, Please upload some attachments like screenshots or codes reproducing the problem.

If you're trying to modify behaviors on the example page, you might need to see functions such as like this one rather than the calendar instance.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants