Skip to content

Commit

Permalink
fixed folder path for MAC and added fallback font
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAndril committed Aug 25, 2021
1 parent c7d7988 commit 498e140
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 7 deletions.
18 changes: 16 additions & 2 deletions src/components/Folder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@
import React, { useEffect, useState } from 'react';
import { useDispatch } from 'react-redux';
import styled from 'styled-components';
import getFolderName from '../utils/getFolderName';
import { setSelectedSubFolder } from '../store/slices/projectsSlice';
import { colors } from '../styles/Constants';
import { SubFolder } from '../types';

const Container = styled.div`
position: relative;
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
width: 13vw;
height: 13vw;
border: 1px solid lightgray;
Expand All @@ -36,6 +41,12 @@ const VideosWatchedContainer = styled.div`
font-size: 0.75em;
`;

const FolderName = styled.p`
letter-spacing: 1px;
text-align: center;
font-size: 0.875em;
`;

type Props = {
element: SubFolder;
dragEnabled: boolean;
Expand All @@ -62,9 +73,12 @@ const Folder: React.FC<Props> = ({ dragEnabled, element }) => {
style={{ cursor: dragEnabled ? 'all-scroll' : 'pointer' }}
onClick={handleClick}
>
<p>{element.folderName.split('/')[1]}</p>
<FolderName>{getFolderName(element.folderName)}</FolderName>
<VideosWatchedContainer>
Viewed: {videosWatched} / {element.videos.length}
Viewed:{' '}
<span style={{ fontWeight: 'bold' }}>
{videosWatched} / {element.videos.length}
</span>
</VideosWatchedContainer>
</Container>
);
Expand Down
5 changes: 4 additions & 1 deletion src/components/SidePlaylist.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ImCheckboxUnchecked, ImCheckboxChecked } from 'react-icons/im';
import styled from 'styled-components';
import { RootState } from '../store';
import { colors } from '../styles/Constants';
import getFolderName from '../utils/getFolderName';

const Container = styled.div`
width: 20%;
Expand Down Expand Up @@ -54,7 +55,9 @@ const SidePlaylist = () => {

return (
<Container>
<PlaylistTitle>{videos?.folderName.split('/')[1]}</PlaylistTitle>
<PlaylistTitle>
{getFolderName(videos?.folderName || 'No Name')}
</PlaylistTitle>
{videos?.videos.map((elem) => (
<a
href={`#${elem.id}`}
Expand Down
2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "local-video-tracker",
"productName": "local-video-tracker",
"version": "0.5.0",
"version": "0.7.0",
"description": "Keep track of your local video files",
"main": "./main.prod.js",
"author": {
Expand Down
2 changes: 0 additions & 2 deletions src/pages/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ const Main: React.FC = () => {
?.rootFolder.folders.videos.length > 0
);

console.log(selectedProjectHasRootVideos);

return (
<>
<MainLayoutContainer>
Expand Down
2 changes: 1 addition & 1 deletion src/styles/Global.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const GlobalStyle = createGlobalStyle`
margin: 0;
padding: 0;
background: #eff0f3;
font-family: workSans;
font-family: workSans, sans-serif;
user-select: none;
margin: 0;
vertical-align: baseline;
Expand Down
6 changes: 6 additions & 0 deletions src/utils/getFolderName.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const getFolderName = (folderName: string) => {
const splittedPath = folderName.split('/');
return splittedPath[splittedPath.length - 1];
};

export default getFolderName;

0 comments on commit 498e140

Please sign in to comment.