TodoList icon indicating copy to clipboard operation
TodoList copied to clipboard

Add ability to show holidays in calendar view.

Open amoraitis opened this issue 4 years ago • 9 comments

Is your feature request related to a problem? Please describe. The user will have the ability to import holidays as tasks to the monthly calendar view.

Describe the solution you'd like Add a new Model class under TodoList/TodoList.Core/Models/: This will need a new migration for the new UserPreferences table.

class UserPreferences
// In iso-3166 format. 1 for now. _In the future create a config value to support multiple countries._
+ UserId: Guid[Key. 1-1 relationship to ApplicationUser.Id]
+ HolidaysInCountry : string

Use Calendarific which offers 1000 free requests/month.

A clear and concise description of any alternative solutions or features you've considered.

Add an HttpClient. Preferably create an IHolidaysCalendarService interface and an implementation of that at HolidaysCalendarService. Investiagate what methods we will need.

Create front-end code that updates the preferences. In the Calendar view or in the user's account menu(add as user preferences tab). This will automatically attach all holidays when navigating to calendar if UserPreferences.HolidaysInCountries is not null in the DB. So, TodosController.Home() Action will also return a list of holidays to be presented. Prepare the View to show the new Data in the same way the existing TODOs do.

  • Add new List of countries to options, preferably a .json file under a /.content folder. Use the response from this request.
  • Add new key-value pair to secrets.json for Calendarific's API key. And base URL to the appsettings.json.

Additional context

Holidays response as documented here: Create this under TodoList/TodoList.Core/Responses/

namespace TodoList.Core.Responses
{
    using System;
    using System.Collections.Generic;

    using System.Globalization;
    using Newtonsoft.Json;
    using Newtonsoft.Json.Converters;

    public partial class HolidaysResponse
    {
        [JsonProperty("meta")]
        public Meta Meta { get; set; }

        [JsonProperty("response")]
        public Response Response { get; set; }
    }

    public partial class Meta
    {
        [JsonProperty("code")]
        public long Code { get; set; }
    }

    public partial class Response
    {
        [JsonProperty("holidays")]
        public Holiday[] Holidays { get; set; }
    }

    public partial class Holiday
    {
        [JsonProperty("name")]
        public string Name { get; set; }

        [JsonProperty("description")]
        public string Description { get; set; }

        [JsonProperty("date")]
        public Date Date { get; set; }

        [JsonProperty("type")]
        public string[] Type { get; set; }
    }

    public partial class Date
    {
        [JsonProperty("iso")]
        public DateTimeOffset Iso { get; set; }

        [JsonProperty("datetime")]
        public Datetime Datetime { get; set; }
    }

    public partial class Datetime
    {
        [JsonProperty("year")]
        public long Year { get; set; }

        [JsonProperty("month")]
        public long Month { get; set; }

        [JsonProperty("day")]
        public long Day { get; set; }
    }
}

amoraitis avatar Jun 08 '20 15:06 amoraitis

Hi I would like to work on this. Can I be assigned to this?

gabrielatricak avatar Oct 04 '20 16:10 gabrielatricak

Hi I would like to work on this. Can I be assigned to this?

Yes, thanks. Let me know if you have any questions.

amoraitis avatar Oct 04 '20 16:10 amoraitis

Is this closed? I can have a look at it if it is still open?

gdhumal avatar Jul 03 '21 14:07 gdhumal

Please take it @gdhumal

amoraitis avatar Aug 18 '21 18:08 amoraitis

@amoraitis , @gdhumal is this issue still open for contribution?

prasadtelkikar avatar Mar 28 '22 17:03 prasadtelkikar

@amoraitis , @gdhumal is this issue still open for contribution?

@prasadtelkikar Yes, you can take it.

amoraitis avatar Mar 28 '22 18:03 amoraitis

@amoraitis is this issue still open for contribution. If yes, can I get more information on what exactly is needed in terms of user experience.

hc-codes avatar Sep 24 '23 11:09 hc-codes

@hc-codes Just a calendar view of tasks. You can generate the experience you like.

amoraitis avatar Oct 10 '23 12:10 amoraitis