Skip to content

Commit

Permalink
Merge pull request #15 from DSaladinCH/develop
Browse files Browse the repository at this point in the history
Workday Settings
  • Loading branch information
DominicSaladin authored Oct 4, 2023
2 parents 20b3488 + a9c39f2 commit e478344
Show file tree
Hide file tree
Showing 25 changed files with 512 additions and 79 deletions.
16 changes: 10 additions & 6 deletions speed-time/Dialogs/ApiLog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
mc:Ignorable="d"
d:DataContext="{d:DesignInstance local:ApiLog}"
d:DesignHeight="300" d:DesignWidth="400" MaxHeight="400">
<potato:DSDialogControl.Resources>
<potato:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
</potato:DSDialogControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50" />
Expand All @@ -24,7 +27,7 @@
<ColumnDefinition Width="60" />
</Grid.ColumnDefinitions>

<Button Grid.Column="0" fa:Content.Icon="SolidArrowLeft" FontSize="15" FontWeight="Bold" HorizontalAlignment="Center" Style="{DynamicResource TransparentButton}"
<potato:DSButton Grid.Column="0" fa:Content.Icon="SolidArrowLeft" FontSize="15" FontWeight="Bold" HorizontalAlignment="Center" Style="{DynamicResource TransparentButton}"
Click="Close_Click" />
<StackPanel Grid.Column="1" VerticalAlignment="Center">
<Label Content="Api Log" FontSize="20" FontWeight="Bold" HorizontalAlignment="Center" Padding="0,0,0,5" />
Expand All @@ -51,13 +54,14 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="20" />
<RowDefinition Height="25" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="{Binding Context, StringFormat='Context: {0}'}" Foreground="{DynamicResource ForegroundA}" Padding="5,5,5,0" />
<Label Grid.Row="0" Grid.Column="0" Content="{Binding Context, StringFormat='Context: {0}'}" Foreground="{DynamicResource ForegroundA}" Padding="5,5,5,5"
VerticalContentAlignment="Center"/>
<StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
<Label Content="Success: " Foreground="{DynamicResource ForegroundA}" Padding="5,5,5,0" />
<Label Padding="5,5,5,0">
<Label Content="Success: " Foreground="{DynamicResource ForegroundA}" Padding="5,5,5,5" />
<Label Padding="5,5,5,5">
<Label.Style>
<Style TargetType="{x:Type Label}" BasedOn="{StaticResource DefaultLabel}">
<Setter Property="fa:Content.Icon" Value="SolidXmark"/>
Expand All @@ -73,7 +77,7 @@
</Label>
</StackPanel>
<TextBlock Grid.Row="1" Grid.ColumnSpan="3" Foreground="{DynamicResource ForegroundDefault}" Text="{Binding ResponseMessage}"
TextWrapping="Wrap" Padding="5,5,5,5" />
TextWrapping="Wrap" Padding="5,5,5,5" Visibility="{Binding HasResponseMessage, Converter={StaticResource BoolToVisibilityConverter}}" />
</Grid>
</Border>
</HierarchicalDataTemplate>
Expand Down
10 changes: 8 additions & 2 deletions speed-time/Dialogs/ApiLog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace DSaladin.SpeedTime.Dialogs
/// </summary>
public partial class ApiLog : DSDialogControl
{
private List<Model.ApiLogEntry> logs;
private List<Model.ApiLogEntry> logs = new();
public List<Model.ApiLogEntry> Logs
{
get { return logs; }
Expand All @@ -38,7 +38,13 @@ public ApiLog(List<Model.ApiLogEntry> logs)
InitializeComponent();
DataContext = this;

Logs = logs;
foreach (Model.ApiLogEntry log in logs)
{
if (!log.IsSuccess)
Logs.Add(log);
else if (!Logs.Exists(l => l.Context == log.Context && l.IsSuccess == log.IsSuccess))
Logs.Add(log);
}
}

private void Close_Click(object sender, RoutedEventArgs e)
Expand Down
4 changes: 2 additions & 2 deletions speed-time/Dialogs/JiraSettings.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
<ColumnDefinition Width="60" />
</Grid.ColumnDefinitions>

<Button Grid.Column="0" fa:Content.Icon="SolidArrowLeft" FontSize="15" FontWeight="Bold" HorizontalAlignment="Center" Style="{DynamicResource TransparentButton}"
<potato:DSButton Grid.Column="0" fa:Content.Icon="SolidArrowLeft" FontSize="15" FontWeight="Bold" HorizontalAlignment="Center" Style="{DynamicResource TransparentButton}"
Click="Close_Click" />

<StackPanel Grid.Column="1" VerticalAlignment="Center">
<Label Content="Jira Settings" FontSize="20" FontWeight="Bold" HorizontalAlignment="Center" Padding="0,0,0,5" />
</StackPanel>

<potato:DSButton Grid.Column="2" fa:Content.Icon="SolidTrash" FontSize="15" FontWeight="Bold" HorizontalAlignment="Center" Style="{DynamicResource TransparentAccentErrorButton}"
<potato:DSButton Grid.Column="2" fa:Content.Icon="SolidTrash" FontSize="15" FontWeight="Bold" HorizontalAlignment="Center" Style="{DynamicResource TransparentErrorButton}"
Click="DeleteClose_Click" />
</Grid>

Expand Down
4 changes: 2 additions & 2 deletions speed-time/Dialogs/TaskLinkEditor.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<ColumnDefinition Width="60" />
</Grid.ColumnDefinitions>

<Button Grid.Column="0" fa:Content.Icon="SolidArrowLeft" FontSize="15" FontWeight="Bold" HorizontalAlignment="Center" Style="{DynamicResource TransparentButton}"
<potato:DSButton Grid.Column="0" fa:Content.Icon="SolidArrowLeft" FontSize="15" FontWeight="Bold" HorizontalAlignment="Center" Style="{DynamicResource TransparentButton}"
Click="Close_Click" />
<Label Grid.Column="1" Content="{x:Static language:SpeedTime.tasklinkeditor_title}" FontSize="20" FontWeight="Bold" HorizontalAlignment="Center" />
</Grid>
Expand All @@ -55,7 +55,7 @@
<CheckBox Grid.Column="0" Content="0-9" IsChecked="{Binding ContainsNumbers}" />
<CheckBox Grid.Column="1" Content="A-Z" IsChecked="{Binding ContainsLetters}" />
</Grid>
<Button Grid.Row="3" Content="{x:Static language:SpeedTime.Cancel}" Style="{DynamicResource AccentButton}" Width="100" Margin="0,10,0,0"
<potato:DSButton Grid.Row="3" Content="{x:Static language:SpeedTime.Cancel}" Style="{DynamicResource AccentErrorButton}" Width="100" Margin="0,10,0,0"
HorizontalAlignment="Left" Command="{Binding CancelAndCloseCommand}" />
</Grid>
</Grid>
Expand Down
4 changes: 2 additions & 2 deletions speed-time/Dialogs/TaskLinking.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
<ColumnDefinition Width="60" />
</Grid.ColumnDefinitions>

<Button Grid.Column="0" fa:Content.Icon="SolidArrowLeft" FontSize="15" FontWeight="Bold" HorizontalAlignment="Center" Style="{DynamicResource TransparentButton}"
<potato:DSButton Grid.Column="0" fa:Content.Icon="SolidArrowLeft" FontSize="15" FontWeight="Bold" HorizontalAlignment="Center" Style="{DynamicResource TransparentButton}"
Click="Close_Click" />
<Label Grid.Column="1" Content="{x:Static language:SpeedTime.tasklinking_title}" FontSize="20" FontWeight="Bold" HorizontalAlignment="Center" />
<Button Grid.Column="2" fa:Content.Icon="SolidPlus" FontSize="15" FontWeight="Bold" HorizontalAlignment="Center" Style="{DynamicResource TransparentButton}"
<potato:DSButton Grid.Column="2" fa:Content.Icon="SolidPlus" FontSize="15" FontWeight="Bold" HorizontalAlignment="Center" Style="{DynamicResource TransparentButton}"
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type potato:DSDialogControl}}, Path=DataContext.AddCommand}" />
</Grid>

Expand Down
4 changes: 2 additions & 2 deletions speed-time/Dialogs/TrackTimeEditor.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<ColumnDefinition Width="60" />
</Grid.ColumnDefinitions>

<Button Grid.Column="0" fa:Content.Icon="SolidArrowLeft" FontSize="15" FontWeight="Bold" HorizontalAlignment="Center" Style="{DynamicResource TransparentButton}"
<potato:DSButton Grid.Column="0" fa:Content.Icon="SolidArrowLeft" FontSize="15" FontWeight="Bold" HorizontalAlignment="Center" Style="{DynamicResource TransparentButton}"
Click="Close_Click" />
<Label Grid.Column="1" Content="{x:Static language:SpeedTime.timeeditor_title}" FontSize="20" FontWeight="Bold" HorizontalAlignment="Center" />
<potato:DSTextBox Style="{DynamicResource TransparentTextBox}" Grid.Column="1" Grid.RowSpan="2" FontSize="11" FontWeight="Bold"
Expand Down Expand Up @@ -80,7 +80,7 @@
</potato:DSTextBox>
</Grid>
<CheckBox x:Name="ckb_break" Grid.Row="2" Content="{x:Static language:SpeedTime.timeeditor_break}" Margin="5,0,0,0" IsChecked="{Binding IsBreak}" HorizontalAlignment="Center" />
<Button Grid.Row="3" Content="{x:Static language:SpeedTime.Cancel}" Style="{DynamicResource AccentButton}" Width="100" Margin="0,10,0,0"
<potato:DSButton Grid.Row="3" Content="{x:Static language:SpeedTime.Cancel}" Style="{DynamicResource AccentErrorButton}" Width="100" Margin="0,10,0,0"
HorizontalAlignment="Left" Command="{Binding CancelAndCloseCommand}" />
</Grid>
</Grid>
Expand Down
6 changes: 4 additions & 2 deletions speed-time/Dialogs/UpdateApp.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
Style="{DynamicResource Title5Label}" HorizontalContentAlignment="Center" />
</StackPanel>
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center">
<Button Content="{x:Static language:SpeedTime.updateapp_cancel}" Style="{DynamicResource AccentButton}" Margin="15,0,10,15" Width="130" Command="{Binding DenyCommand}" />
<Button Content="{x:Static language:SpeedTime.updateapp_download}" Style="{DynamicResource AccentButton}" Margin="10,0,15,15" Width="130" Command="{Binding DownloadCommand}" />
<potato:DSButton Content="{x:Static language:SpeedTime.updateapp_cancel}" Style="{DynamicResource AccentErrorButton}" Margin="15,0,10,15"
Width="130" Command="{Binding DenyCommand}" />
<potato:DSButton Content="{x:Static language:SpeedTime.updateapp_download}" Style="{DynamicResource AccentOkButton}" Margin="10,0,15,15"
Width="130" Command="{Binding DownloadCommand}" />
</StackPanel>
</Grid>
</potato:DSDialogControl>
15 changes: 8 additions & 7 deletions speed-time/Dialogs/UserSettings.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type settings:ActionSetting}">
<Button Grid.Column="1" Height="30" Content="{Binding ActionText}" Padding="0" Command="{Binding ActionCommand}" />
<potato:DSButton Grid.Column="1" Height="30" Content="{Binding ActionText}" Padding="0" Command="{Binding ActionCommand}" />
</ControlTemplate>
</Setter.Value>
</Setter>
Expand Down Expand Up @@ -79,12 +79,12 @@
<ColumnDefinition Width="60" />
</Grid.ColumnDefinitions>

<Button Grid.Column="0" fa:Content.Icon="SolidArrowLeft" FontSize="15" FontWeight="Bold" HorizontalAlignment="Center" Style="{DynamicResource TransparentButton}"
<potato:DSButton Grid.Column="0" fa:Content.Icon="SolidArrowLeft" FontSize="15" FontWeight="Bold" HorizontalAlignment="Center" Style="{DynamicResource TransparentButton}"
Click="Close_Click" />
<Label Grid.Column="1" Content="{x:Static language:SpeedTime.settings_title}" FontSize="20" FontWeight="Bold" HorizontalAlignment="Center" />
</Grid>

<Grid Grid.Row="1" Margin="15,0,15,10">
<Grid Grid.Row="1" Margin="10,0,10,10">
<ListBox x:Name="lsbOptions" Background="{x:Null}" BorderBrush="{x:Null}" VirtualizingPanel.IsVirtualizing="False"
VirtualizingPanel.ScrollUnit="Pixel" ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="{DynamicResource ForegroundDefault}">
<ListBox.Resources>
Expand Down Expand Up @@ -130,11 +130,12 @@
Value="{Binding Source={x:Static potato:ColorManagement.Instance}, Path=CurrAccent}" />
<settings:CheckBoxSetting Category="Behavior" OptionName="{x:Static language:SpeedTime.settings_auto_break}"
Value="{Binding Source={x:Static models:SettingsModel.Instance}, Path=AutoAddBreak}"/>
<settings:NumberTextBoxSetting Category="Behavior" OptionName="{x:Static language:SpeedTime.settings_weekly_hour}"
Value="{Binding Source={x:Static models:SettingsModel.Instance}, Path=WeeklyWorkHours}"/>
<settings:ActionSetting Category="Integrations" OptionName="{x:Static language:SpeedTime.settings_task_linking}"
<settings:ActionSetting Category="Behavior" OptionName="{x:Static language:SpeedTime.settings_workdays}"
ActionText="{x:Static language:SpeedTime.open}"
ActionCommand="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:UserSettings}}, Path=TaskLinkingCommand}" />
ActionCommand="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:UserSettings}}, Path=WorkdaysCommand}" />
<!--<settings:ActionSetting Category="Integrations" OptionName="{x:Static language:SpeedTime.settings_task_linking}"
ActionText="{x:Static language:SpeedTime.open}"
ActionCommand="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:UserSettings}}, Path=TaskLinkingCommand}" />-->
<settings:ActionSetting Category="Integrations" OptionName="Jira"
ActionText="{x:Static language:SpeedTime.open}"
ActionCommand="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:UserSettings}}, Path=JiraCommand}" />
Expand Down
2 changes: 2 additions & 0 deletions speed-time/Dialogs/UserSettings.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public string CurrentVersion

public RelayCommand TaskLinkingCommand { get; set; }
public RelayCommand JiraCommand { get; set; }
public RelayCommand WorkdaysCommand { get; set; }

public UserSettings()
{
Expand All @@ -58,6 +59,7 @@ public UserSettings()
SettingsModel.Instance.TaskLinks = await ShowDialog<List<TaskLink>>(new TaskLinking(SettingsModel.Instance.TaskLinks)) ?? new());

JiraCommand = new(async a => await ShowDialog(new JiraSettings()));
WorkdaysCommand = new(async a => await ShowDialog(new Workdays()));
#endregion

CurrentVersion = Assembly.GetExecutingAssembly().GetName().Version!.ToString();
Expand Down
Loading

0 comments on commit e478344

Please sign in to comment.