Skip to content

Commit f863b3d

Browse files
committed
Video attachments.
1 parent abce3d8 commit f863b3d

7 files changed

Lines changed: 505 additions & 103 deletions

File tree

Public/app/css/main.css

Lines changed: 136 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1639,26 +1639,78 @@ input[type="text"]:disabled, textarea:disabled {
16391639
display: flex;
16401640
flex-direction: column;
16411641
align-items: center;
1642-
justify-content: flex-start;
16431642
cursor: default;
16441643
}
16451644

1646-
.media-viewer-header {
1647-
position: absolute;
1648-
top: 0;
1649-
left: 0;
1650-
right: 0;
1651-
padding: 1.5rem;
1645+
.media-viewer-top-bar {
1646+
width: 100%;
1647+
height: 60px;
1648+
flex-shrink: 0;
16521649
display: flex;
1653-
justify-content: space-between;
16541650
align-items: center;
1651+
justify-content: space-between;
1652+
padding: 0 1.5rem;
16551653
z-index: 10001;
1654+
background-color: rgba(0, 0, 0, 0.4);
1655+
}
1656+
1657+
.media-viewer-top-bar-left {
1658+
flex: 1;
1659+
min-width: 0;
16561660
}
16571661

1658-
.media-viewer-title {
1662+
.media-viewer-top-bar-center {
1663+
flex: 0 1 auto;
1664+
display: flex;
1665+
flex-direction: column;
1666+
align-items: center;
1667+
justify-content: center;
1668+
min-width: 0;
1669+
text-align: center;
1670+
}
1671+
1672+
.media-viewer-message-preview {
16591673
color: white;
1660-
font-size: 1.125rem;
1674+
font-size: 0.875rem;
16611675
font-weight: 500;
1676+
line-height: 1.3;
1677+
white-space: nowrap;
1678+
overflow: hidden;
1679+
text-overflow: ellipsis;
1680+
max-width: 400px;
1681+
}
1682+
1683+
.media-viewer-date {
1684+
color: rgba(255, 255, 255, 0.6);
1685+
font-size: 0.75rem;
1686+
line-height: 1.3;
1687+
}
1688+
1689+
.media-viewer-top-bar-right {
1690+
flex: 1;
1691+
min-width: 0;
1692+
display: flex;
1693+
align-items: center;
1694+
justify-content: flex-end;
1695+
gap: 0.5rem;
1696+
}
1697+
1698+
.media-viewer-action-btn {
1699+
width: 40px;
1700+
height: 40px;
1701+
border-radius: 50%;
1702+
background-color: rgba(255, 255, 255, 0.1);
1703+
color: white;
1704+
border: none;
1705+
display: flex;
1706+
align-items: center;
1707+
justify-content: center;
1708+
cursor: pointer;
1709+
transition: background-color 0.2s ease;
1710+
}
1711+
1712+
.media-viewer-action-btn:hover {
1713+
background-color: rgba(255, 255, 255, 0.2);
16621714
}
16631715

16641716
.media-viewer-close {
@@ -1679,15 +1731,26 @@ input[type="text"]:disabled, textarea:disabled {
16791731
background-color: rgba(255, 255, 255, 0.2);
16801732
}
16811733

1682-
.media-viewer-image-container {
1734+
.media-viewer-content-container {
16831735
position: relative;
16841736
width: 100%;
16851737
flex: 1;
16861738
display: flex;
16871739
align-items: center;
16881740
justify-content: center;
1689-
padding: 5rem 2rem 2rem 2rem;
1741+
padding: 0 2rem;
16901742
min-height: 0;
1743+
overflow: hidden;
1744+
}
1745+
1746+
.media-viewer-media {
1747+
display: flex;
1748+
align-items: center;
1749+
justify-content: center;
1750+
max-width: 100%;
1751+
max-height: 100%;
1752+
width: 100%;
1753+
height: 100%;
16911754
}
16921755

16931756
.media-viewer-image {
@@ -1697,6 +1760,13 @@ input[type="text"]:disabled, textarea:disabled {
16971760
border-radius: 0.5rem;
16981761
}
16991762

1763+
.media-viewer-video {
1764+
max-width: 100%;
1765+
max-height: 100%;
1766+
border-radius: 0.5rem;
1767+
outline: none;
1768+
}
1769+
17001770
.media-viewer-chevron {
17011771
position: absolute;
17021772
top: 50%;
@@ -1728,13 +1798,22 @@ input[type="text"]:disabled, textarea:disabled {
17281798
right: 2rem;
17291799
}
17301800

1801+
.media-viewer-bottom-bar {
1802+
width: 100%;
1803+
height: 60px;
1804+
flex-shrink: 0;
1805+
display: flex;
1806+
align-items: center;
1807+
justify-content: center;
1808+
z-index: 10001;
1809+
background-color: rgba(0, 0, 0, 0.4);
1810+
}
1811+
17311812
.media-viewer-pagination {
17321813
display: flex;
17331814
justify-content: center;
17341815
align-items: center;
17351816
gap: 7.5px;
1736-
padding: 1rem 0;
1737-
z-index: 10001;
17381817
}
17391818

17401819
.media-viewer-pagination-dot {
@@ -1756,21 +1835,6 @@ input[type="text"]:disabled, textarea:disabled {
17561835
background-color: hsl(0 0% 100%);
17571836
}
17581837

1759-
.media-viewer-text {
1760-
width: 100%;
1761-
padding: 2rem;
1762-
color: white;
1763-
font-size: 1rem;
1764-
line-height: 1.5;
1765-
text-align: center;
1766-
background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.5) 50%, transparent 100%);
1767-
z-index: 10000;
1768-
white-space: pre-wrap;
1769-
word-wrap: break-word;
1770-
max-height: 30%;
1771-
overflow-y: auto;
1772-
}
1773-
17741838
.user-profile-section {
17751839
margin-bottom: 1.5rem;
17761840
}
@@ -2703,10 +2767,14 @@ input[type="text"]:disabled, textarea:disabled {
27032767
.attachment-preview-item {
27042768
position: relative;
27052769
height: 130px;
2770+
min-width: 100px;
27062771
border-radius: 5px;
27072772
overflow: hidden;
27082773
background-color: hsl(var(--muted));
27092774
flex-shrink: 0;
2775+
display: flex;
2776+
align-items: center;
2777+
justify-content: center;
27102778
}
27112779

27122780
.attachment-preview-item img {
@@ -2719,7 +2787,12 @@ input[type="text"]:disabled, textarea:disabled {
27192787
}
27202788

27212789
.attachment-preview-video-icon {
2722-
font-size: 2rem;
2790+
display: flex;
2791+
align-items: center;
2792+
justify-content: center;
2793+
width: 100%;
2794+
height: 100%;
2795+
color: hsl(var(--muted-foreground));
27232796
}
27242797

27252798
.attachment-close-button {
@@ -2830,12 +2903,42 @@ input[type="text"]:disabled, textarea:disabled {
28302903
box-sizing: border-box;
28312904
}
28322905

2833-
.message-attachment-video {
2906+
.message-attachment-video-wrapper {
2907+
position: relative;
28342908
width: 100%;
28352909
height: 300px;
2836-
display: block;
28372910
min-width: 200px;
28382911
box-sizing: border-box;
2912+
display: flex;
2913+
align-items: center;
2914+
justify-content: center;
2915+
}
2916+
2917+
.video-camera-icon {
2918+
position: absolute;
2919+
bottom: 8px;
2920+
left: 8px;
2921+
width: 28px;
2922+
height: 28px;
2923+
border-radius: 50%;
2924+
background-color: rgba(0, 0, 0, 0.5);
2925+
color: white;
2926+
display: flex;
2927+
align-items: center;
2928+
justify-content: center;
2929+
cursor: pointer;
2930+
transition: background-color 0.2s ease;
2931+
z-index: 5;
2932+
}
2933+
2934+
.video-camera-icon:hover {
2935+
background-color: rgba(0, 0, 0, 0.7);
2936+
}
2937+
2938+
.message-attachment-video {
2939+
height: 100%;
2940+
object-fit: cover;
2941+
display: block;
28392942
}
28402943

28412944
.message-attachment-chevron {
@@ -3010,7 +3113,7 @@ input[type="text"]:disabled, textarea:disabled {
30103113
right: 4px;
30113114
width: 24px;
30123115
height: 24px;
3013-
pointer-events: none;
3116+
cursor: pointer;
30143117
filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
30153118
z-index: 10;
30163119
}

Public/app/js/api.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,10 @@ function getPreviewUrl(fileId, fileType) {
640640
return `/uploads/${fileId}-preview.${fileType}`;
641641
}
642642

643+
function getVideoPreviewUrl(fileId) {
644+
return `/uploads/${fileId}-preview.jpg`;
645+
}
646+
643647
async function apiGetRecentMedia() {
644648
const accessToken = getAccessToken();
645649
if (!accessToken) throw new Error('No access token available');

0 commit comments

Comments
 (0)