Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/lib/showFileInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ export default async function showFileInfo(url) {
const protocol = Url.getProtocol(url);
const fileType = type.toLowerCase();
const options = {
name,
name: name.slice(0, name.length - Url.extname(name).length),
extension: Url.extname(name),
lastModified,
length,
type,
Expand Down
155 changes: 92 additions & 63 deletions src/styles/fileInfo.scss
Original file line number Diff line number Diff line change
@@ -1,63 +1,92 @@
#file-info {
.name {
min-height: 40px;
display: flex;
flex-direction: row;
align-items: center;

.text {
font-size: 1.5rem;
font-weight: bold;
opacity: 1;
}
}

.share-button {
border: none;
box-sizing: border-box;
background-color: rgb(51, 153, 255);
background-color: var(--button-background-color);
color: rgb(255, 255, 255);
color: var(--primary-text-color);
display: flex;
justify-content: center;
align-items: center;
height: 30px;
min-width: fit-content;
margin: 5px auto;
padding: 0 10px;
border-radius: 20px;

* {
pointer-events: none;
}

.text {
overflow: hidden;
text-overflow: ellipsis;
text-align: left;
}

.icon {
height: 30px;
margin-right: 10px;
}
}

>div {
display: flex;
flex-direction: column;
margin-bottom: 10px;

>span:first-child {
font-size: 0.95rem;
opacity: 0.5;
margin-right: 10px;
}

>span:last-child {
max-width: 100%;
overflow: auto;
}
}
}
#file-info {
overflow-x: hidden;
padding: 0.8rem;

.file-header {
margin-bottom: 1.5rem;

.file-name {
font-size: 1.25rem;
font-weight: 500;
color: var(--secondary-text-color);
display: flex;
align-items: center;
gap: 0.5rem;
flex-wrap: wrap;

.name-part {
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
position: relative;

&:hover {
overflow: visible;
white-space: normal;
word-break: break-all;
z-index: 1;
border-radius: 4px;
background: var(--popup-background-color);
}
}
.file-extension {
background: var(--popup-active-color);
padding: 0.25rem 0.5rem;
border-radius: 4px;
font-size: 0.875rem;
color: var(--link-text-color);
font-weight: 600;
letter-spacing: 0.5px;
text-transform: uppercase;
flex-shrink: 0;
}
}
}

.info-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 1.5rem;
}

.info-item {
display: flex;
flex-direction: column;
gap: 0.5rem;

.info-label {
font-size: 0.875rem;
color: color-mix(in srgb, var(--secondary-text-color) 60%, transparent);
text-transform: uppercase;
letter-spacing: 0.5px;
}

.info-value {
font-size: 1rem;
color: var(--secondary-text-color);
font-weight: 500;
}
}

.path-section {
margin-top: 1.5rem;
padding-top: 1.5rem;
border-top: 1px solid var(--popup-border-color);

.path-value {
word-break: break-all;
}
}

@media (max-width: 480px) {
.file-card {
padding: 1.5rem;
}

.info-grid {
grid-template-columns: 1fr;
gap: 1rem;
}
}
}
65 changes: 37 additions & 28 deletions src/views/file-info.hbs
Original file line number Diff line number Diff line change
@@ -1,31 +1,40 @@
<div id='file-info'>
<div class='name'>
<span class='text'>{{name}}</span>
</div>
<div>
<span>{{lang.size}}</span>
<span>{{length}}</span>
</div>
<div class='lm'>
<span>{{lang.last modified}}</span>
<span>{{lastModified}}</span>
</div>
{{#isEditor}}
<div>
<span>{{lang.line count}}</span>
<span>{{lineCount}}</span>
<div id="file-info">
<div class="file-header">
<div class="file-name">
<span class="name-part">{{name}}</span>
<span class="file-extension">{{extension}}</span>
</div>
</div>
<div>
<span>{{lang.word count}}</span>
<span>{{wordCount}}</span>

<div class="info-grid">
<div class="info-item">
<span class="info-label">{{lang.size}}</span>
<span class="info-value">{{length}}</span>
</div>
<div class="info-item">
<span class="info-label">{{lang.type}}</span>
<span class="info-value">{{type}}</span>
</div>
<div class="info-item">
<span class="info-label">{{lang.last modified}}</span>
<span class="info-value">{{lastModified}}</span>
</div>
{{#isEditor}}
<div class="info-item">
<span class="info-label">{{lang.line count}}</span>
<span class="info-value">{{lineCount}}</span>
</div>
<div class="info-item">
<span class="info-label">{{lang.word count}}</span>
<span class="info-value">{{wordCount}}</span>
</div>
{{/isEditor}}
</div>

<div class="path-section">
<div class="info-item">
<span class="info-label">{{lang.path}}</span>
<span class="info-value path-value" action="copy">{{showUri}}</span>
</div>
</div>
{{/isEditor}}
<div>
<span>{{lang.type}}</span>
<span>{{type}}</span>
</div>
<div class='location'>
<span>{{lang.path}}</span>
<span class='scroll' action='copy'>{{showUri}}</span>
</div>
</div>