This repository has been archived by the owner on Feb 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4662 from toggl-open-source/fix/timeline_ui/resizing
Fix resizing stops when TE update arrives
- Loading branch information
Showing
12 changed files
with
163 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/ui/windows/TogglDesktop/TogglDesktop/ui/Behaviors/TimelineTimeEntryPopupHelper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using TogglDesktop.ViewModels; | ||
|
||
namespace TogglDesktop.Behaviors | ||
{ | ||
public static class TimelineTimeEntryPopupHelper | ||
{ | ||
public static void OpenPopup(this TimelineTimeEntryBlockPopup popup, FrameworkElement placementTarget, ScrollViewer scroll) | ||
{ | ||
if (placementTarget.DataContext is TimeEntryBlock curBlock) | ||
{ | ||
popup.DataContext = curBlock; | ||
popup.Popup.PlacementTarget = placementTarget; | ||
popup.Popup.IsOpen = true; | ||
var visibleTopOffset = scroll.VerticalOffset + 10; | ||
var visibleBottomOffset = scroll.VerticalOffset + scroll.ActualHeight - 10; | ||
var offset = curBlock.VerticalOffset + placementTarget.ActualHeight / 2; | ||
popup.Popup.VerticalOffset = Math.Min(Math.Max(visibleTopOffset, offset), visibleBottomOffset) - | ||
curBlock.VerticalOffset; | ||
} | ||
} | ||
|
||
public static void ClosePopup(this TimelineTimeEntryBlockPopup popup) | ||
{ | ||
popup.Popup.IsOpen = false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
src/ui/windows/TogglDesktop/TogglDesktop/ui/controls/TimelineTimeEntryBlockPopup.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<UserControl x:Class="TogglDesktop.TimelineTimeEntryBlockPopup" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:viewModels="clr-namespace:TogglDesktop.ViewModels" | ||
mc:Ignorable="d" | ||
d:DesignHeight="450" d:DesignWidth="800" | ||
d:DataContext="{d:DesignInstance viewModels:TimeEntryBlock, IsDesignTimeCreatable=False}"> | ||
<Popup Placement="Right" | ||
HorizontalOffset="5" | ||
StaysOpen="True" | ||
Name="Popup"> | ||
<Border BorderBrush="{DynamicResource Toggl.PopupBorderBrush}" BorderThickness="1" Focusable="False" | ||
Background="{DynamicResource Toggl.CardBackground}"> | ||
<Border.Effect> | ||
<DropShadowEffect ShadowDepth="1" BlurRadius="4" Direction="270" Opacity="0.2" Color="Black" /> | ||
</Border.Effect> | ||
<Grid Margin="8 8 8 8"> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="*"/> | ||
<ColumnDefinition Width="Auto"/> | ||
</Grid.ColumnDefinitions> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto"/> | ||
<RowDefinition Height="Auto"/> | ||
<RowDefinition Height="Auto"/> | ||
<RowDefinition Height="Auto"/> | ||
<RowDefinition Height="Auto"/> | ||
</Grid.RowDefinitions> | ||
<TextBlock Margin="0 0 5 0" Grid.Row="0" Grid.Column="0" Text="{Binding StartEndCaption}" Style="{StaticResource Toggl.CaptionBlackText}"/> | ||
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Duration}" Style="{StaticResource Toggl.CaptionBlackText}"/> | ||
<TextBlock Margin="0 10 0 0" Grid.Row="1" Grid.Column="0" Text="{Binding Description}" Style="{StaticResource Toggl.CaptionBlackText}"/> | ||
<DockPanel Grid.Row="2" Grid.Column="0" Margin="0 4 0 0"> | ||
<Ellipse Width="8" Height="8" | ||
DockPanel.Dock="Left" | ||
Margin="0 0 5 0" | ||
VerticalAlignment="Center" | ||
Fill="{Binding Color, Converter={StaticResource AdaptProjectTextColorConverter}}" | ||
Visibility="{Binding ProjectName, Converter={StaticResource EmptyStringToCollapsedConverter}}"/> | ||
<TextBlock Foreground="{Binding Color, Converter={StaticResource AdaptProjectTextColorConverter}}" | ||
Text="{Binding ProjectName}" FontSize="12" | ||
VerticalAlignment="Center"/> | ||
<TextBlock Foreground="{Binding Color, Converter={StaticResource AdaptProjectTextColorConverter}}" | ||
Padding="4 0 0 0" | ||
Text="{Binding TaskName, Converter={StaticResource StringFormatIfNotEmptyConverter}, ConverterParameter='- {0}'}" | ||
FontSize="12" | ||
Visibility="{Binding TaskName, Converter={StaticResource EmptyStringToCollapsedConverter}}"/> | ||
</DockPanel> | ||
<TextBlock Grid.Row="3" Grid.Column="0" Text="{Binding ClientName}" Style="{StaticResource Toggl.CaptionText}"/> | ||
<StackPanel Orientation="Horizontal" Grid.Row="4" Grid.Column="0"> | ||
<Viewbox Visibility="{Binding HasTag, Converter={StaticResource BooleanToVisibilityConverter}}"> | ||
<Path Style="{StaticResource Toggl.TagIcon}"/> | ||
</Viewbox> | ||
<Viewbox DockPanel.Dock="Left" Visibility="{Binding IsBillable, Converter={StaticResource BooleanToVisibilityConverter}}"> | ||
<Path Style="{StaticResource Toggl.DollarIcon}"/> | ||
</Viewbox> | ||
</StackPanel> | ||
</Grid> | ||
</Border> | ||
</Popup> | ||
</UserControl> |
15 changes: 15 additions & 0 deletions
15
src/ui/windows/TogglDesktop/TogglDesktop/ui/controls/TimelineTimeEntryBlockPopup.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System.Windows.Controls; | ||
|
||
namespace TogglDesktop | ||
{ | ||
/// <summary> | ||
/// Interaction logic for TimelineTimeEntryBlockPopup.xaml | ||
/// </summary> | ||
public partial class TimelineTimeEntryBlockPopup : UserControl | ||
{ | ||
public TimelineTimeEntryBlockPopup() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.