fix: client file sharing access denied + task/project default tabs
- FileSharing: rootPath for clients strips /Clients/ prefix — API resolveClientPath expects /{company} not /Clients/{company}
- Tasks: default to To Do tab (not_started) instead of All Tasks
- Projects: default to Active tab instead of All Projects
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -270,12 +270,16 @@ async function fbqProxy(op, path, extra = {}) {
|
||||
throw new Error(`Unsupported operation: ${op}`);
|
||||
}
|
||||
|
||||
function safeName(v) {
|
||||
return String(v || '').trim().replace(/[\\/:*?"<>|#%{}^~[\]`]+/g, '-').replace(/\s+/g, ' ').replace(/^-+|-+$/g, '');
|
||||
}
|
||||
|
||||
function rootPath(user) {
|
||||
if (!user || user.role === 'team' || user.role === 'external') return '/';
|
||||
const companies = user.companies?.filter(Boolean) ?? [];
|
||||
if (companies.length > 1) return '/Clients';
|
||||
if (companies.length > 1) return '/';
|
||||
const name = companies[0]?.name ?? user.company?.name;
|
||||
return name ? `/Clients/${name}` : '/';
|
||||
return name ? `/${safeName(name)}` : '/';
|
||||
}
|
||||
|
||||
function parsePath(path) {
|
||||
|
||||
+2
-2
@@ -73,7 +73,7 @@ function TasksStatsRow({ tasks = [] }) {
|
||||
function TasksPageShell({ statsTasks = [], projects = [], onAddProject = null, children }) {
|
||||
const [projSortKey, setProjSortKey] = useState('status');
|
||||
const [projSortDir, setProjSortDir] = useState('asc');
|
||||
const [projTab, setProjTab] = useState('all');
|
||||
const [projTab, setProjTab] = useState('active');
|
||||
const toggleProjSort = (col) => {
|
||||
if (projSortKey === col) setProjSortDir(d => d === 'asc' ? 'desc' : 'asc');
|
||||
else { setProjSortKey(col); setProjSortDir('asc'); }
|
||||
@@ -193,7 +193,7 @@ export default function RequestsPage() {
|
||||
});
|
||||
const [error, setError] = useState('');
|
||||
const [loadError, setLoadError] = useState(false);
|
||||
const [activeTab, setActiveTab] = useState('all');
|
||||
const [activeTab, setActiveTab] = useState('not_started');
|
||||
const [filterCompany, setFilterCompany] = useState('');
|
||||
const [filterProject, setFilterProject] = useState('');
|
||||
const { sortKey, sortDir, toggle, sort } = useSortable('status', 'asc');
|
||||
|
||||
Reference in New Issue
Block a user