hunk.code_window:     @@map("file_conflict")
   }
   // keys allow us to know exactly which files can be decrypted with a given key
   // they can be "mounted" to a client, and then used to decrypt files automatically
   /// @shared(id: uuid)
  
hunk.labels: keep replace replace keep keep keep keep
hunk.after_edit: //     @@map("file_conflict")
   // }
  
hunk.file_path: core/prisma/schema.prisma
hunk.type: replace
file: import { ReactComponent as Ellipsis } from '@sd/assets/svgs/ellipsis.svg';
  import {
  	Archive,
  	Copy,
  	FolderDotted,
  	Gear,
  	Icon,
  	IconContext,
  	Image,
  	Paperclip
  } from 'phosphor-react';
  import { useNavigate } from 'react-router';
  import { Location, useLibraryMutation } from '@sd/client';
  import {
  	Button,
  	Input,
  	Popover,
  	PopoverContainer,
  	PopoverDivider,
  	PopoverSection,
  	Tooltip,
  	tw
  } from '@sd/ui';
  import TopBarButton from '../TopBar/TopBarButton';
  
  const OptionButton = tw(TopBarButton)`w-full gap-1 !px-1.5 !py-1`;
  
  export default function LocationOptions({ location, path }: { location: Location; path: string }) {
  	const navigate = useNavigate();
  
  	const _scanLocation = useLibraryMutation('locations.fullRescan');
  	const scanLocation = () => _scanLocation.mutate(location.id);
  
  	const _regenThumbs = useLibraryMutation('jobs.generateThumbsForLocation');
  	const regenThumbs = () => _regenThumbs.mutate({ id: location.id, path });
  
  	const archiveLocation = () => alert('Not implemented');
  
  	let currentPath = path ? location.path + path : location.path;
  
  	currentPath = currentPath?.endsWith('/')
  		? currentPath.substring(0, currentPath.length - 1)
  		: currentPath;
  
  	return (
  		<div className="opacity-30 group-hover:opacity-70">
  			<IconContext.Provider value={{ size: 20, className: 'r-1 h-4 w-4 opacity-60' }}>
  				<Popover
  					trigger={
  						<Button className="!p-[5px]" variant="subtle">
  							<Ellipsis className="h-3 w-3" />
  						</Button>
  					}
  				>
  					<PopoverContainer>
  						<PopoverSection>
  							<Input
  								autoFocus
  								className="mb-2"
  								value={currentPath ?? ''}
  								onChange={() => { }}
  								right={
  									<Tooltip label="Copy path to clipboard" className="flex">
  										<Button
  											size="icon"
  											variant="outline"
  											className="opacity-70"
  											onClick={() =>
  												currentPath &&
  												navigator.clipboard.writeText(currentPath)
  											}
  										>
  											<Copy className="!pointer-events-none h-4 w-4" />
  										</Button>
  									</Tooltip>
  								}
  							/>
  							<OptionButton
  								onClick={() =>
  									navigate(`../settings/library/locations/${location.id}`)
  								}
  							>
  								<Gear />
  								Configure Location
  							</OptionButton>
  						</PopoverSection>
  						<PopoverDivider />
  						<PopoverSection>
  							<OptionButton onClick={scanLocation}>
  								<FolderDotted />
  								Re-index
  							</OptionButton>
  							<OptionButton onClick={regenThumbs}>
  								<Image />
  								Regenerate Thumbs
  							</OptionButton>
  						</PopoverSection>
  						<PopoverDivider />
  						<PopoverSection>
  							<OptionButton onClick={archiveLocation}>
  								<Archive />
  								Archive
  							</OptionButton>
  						</PopoverSection>
  					</PopoverContainer>
  				</Popover>
  			</IconContext.Provider>
  		</div>
  	);
  }
  