Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(navigation): simplify apps and files sidebar controls (#105754)

Marius Andra0a05fe429b9b
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 6e26fef28548..0bbbb643b7a2 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -3733,13 +3733,13 @@ snapshots:
insights-worldmap--default--light:
hash: v1.k794b7964.a4f523dbe2e78f12ddf6c95d6e1e0b1da4457008aa42a9b83fb5e21bc4519915.sRV9jpfMOemd-Hss7Y7z4hMMwHYzM7l8Dq9i4uoJBiE
layout-apps-and-files--apps--dark:
- hash: v1.k794b7964.dd82b963958ba872734d3c0d55f0ca83b32226e955c1edde40e2fc99a3b84d9c.0pR2tymcMAUK1K78kHe1fAEZ82Y9MsqyojywzC64TOg
+ hash: v1.k794b7964.c59540718833b2dd92b5eb1b617c8652866673b7c699e7c825171fa3def9dba5.pelu5m0sY_PTqKOjJ1dIuPzqZRF4hPCjU1nIHWQv8vA
layout-apps-and-files--apps--light:
- hash: v1.k794b7964.63ef13ee6a768284a5380240d7c58f18dc8de2ca323facd3e6e7423588b1dd88.TTL_Zno8RJK3LwWGYlPeIscuwEZ9puCVFNG3JY6Coc8
+ hash: v1.k794b7964.0b366ec2f75949f2fc7dd2c8a858e5ee163f189276525bff44569a0e8088b39a.r9ue6BNz9Lm8O17LCoyvNP0tPE9s8m_KDoQPciBTfJo
layout-apps-and-files--apps-overlay--dark:
- hash: v1.k794b7964.4ddb3a7b23a55a72279b53e7c9b295177a77ecbf37b2b286f5854ac3ebcde06c.RitTBDBOzOKrZp57VdemAPIuJE0_VXDkFzBR3gDqIR8
+ hash: v1.k794b7964.f7f4dcd5b5603e75b75745fae41f150cdea6e947559ad58e710a4f471b99bd76.5KGLXR1_ZwLP7mHhDWHOx7GMXq9r6oo0KD0ku-SX7Bc
layout-apps-and-files--apps-overlay--light:
- hash: v1.k794b7964.ed56f8827a5d5340c946fb4cd6196cfb67e4fe9075aa32842e0c4fbf3fa0a8bb.S_ZufgyOXB8EBLitnikJHNtgdOq9VFRGgJMzO1aYLMo
+ hash: v1.k794b7964.c8eca248dd3c3e88e5fe2abab3ee40ea65ff8fd2c49a61823de0b36a8d527125.VTCZNB13Hztepa3mEcjZA_AikYCK4eeSgEf8c1j6CI8
layout-apps-and-files--chat--dark:
hash: v1.k794b7964.ef1b497492e443be192221d641c8f963d006086964bf4ea013ef5509a0045673.P5F7czhc_C2ppO1ade_5-5pfPL8a1ChBK17EKo9jaIs
layout-apps-and-files--chat--light:
@@ -3749,53 +3749,65 @@ snapshots:
layout-apps-and-files--collapsed--light:
hash: v1.k794b7964.4e69eef40e28d9b063759264639ee685ce796c07a623bd78aabb7cc51a6eea59.EquaH8oP-2UUsgXNQGDkK-ZZWpWsFWL2U-K1tVlOOpM
layout-apps-and-files--dark--dark:
- hash: v1.k794b7964.dd82b963958ba872734d3c0d55f0ca83b32226e955c1edde40e2fc99a3b84d9c.eFHOgvFM3mf9X-eiGYVRflYlYk0AlbJdvCugBMKPCXM
+ hash: v1.k794b7964.c59540718833b2dd92b5eb1b617c8652866673b7c699e7c825171fa3def9dba5.cQu9stCSZ3mAmicIxO07iNmIiMxz2oyIJBAYFOGu_4w
layout-apps-and-files--dark--light:
- hash: v1.k794b7964.aac1750c50985ae33891062522f2578ddeab3cfb36666e333ac3ca739ec81d4b.gwZPvTEF8QJH0cZaCNJkrWCvVEgSRtwRVAhO5LuBnkc
+ hash: v1.k794b7964.0b366ec2f75949f2fc7dd2c8a858e5ee163f189276525bff44569a0e8088b39a.qFd18rSb_icAPlb-2ofVNglBk5UBKVeegMMaqJ84jZw
layout-apps-and-files--empty-starred--dark:
- hash: v1.k794b7964.05cfbe3420cf01623aeeede4d24e9ff3b95ee7886a511ad1b96096be8f3c5f17.x5qW9nqazNvcETI5MWBtjj1INSdZeS4haAVWXftsYLU
+ hash: v1.k794b7964.274b162537b5cbe20226c7cedad0b7ac4c10825a6048047aad4f40b7e3be6bb2.pY-6L1tyXwLcPlKqmKVfCpVK1YYi7oGm2JjEvn3i7SA
layout-apps-and-files--empty-starred--light:
- hash: v1.k794b7964.46240ce120fcab7e25816061e6fcc11b606a45043823bd5fd98c618e72f8a0d6.3DqTmhawv-ByeekMs5zX3YHNCyN53e2ME45So679jpo
+ hash: v1.k794b7964.70d57c4bd8317d39ed79525a28863cc348add3be342831c2551d232344844743.zdXcrG_wrpRIsjMLsyiW4PtmRlqVH8z9aNpmJqpPbus
layout-apps-and-files--files--dark:
- hash: v1.k794b7964.104706ddcb2e161b6299b46246ce691e32ad60617b388a66065a7296d1b075d4.mzPTZkWvPnDzt50FfcnQOwk_qeXsXy43mXy3FFYwq5c
+ hash: v1.k794b7964.e724be4ea053f69550dafc783c88c627819665dda7e6631348f50539cfd8db56.rGr9vJYIbqbdW1A2Sfd-hGoXP0A-EkCqw4KJW1QaG94
layout-apps-and-files--files--light:
- hash: v1.k794b7964.fa35cc09cae56ce857495a05fc9b25ff56c993be884668b7b6f86a4d5c41f2d9.0C8586ZMcgdutWzrYrhKdBzdZHRBoshLP2XJe2pW5mU
+ hash: v1.k794b7964.f598fa23ae8b977997a21689ecb7fcf291d48e9e86a15fa336008bd887ab0d41._WWUieWv3EA7pGM2ZZV7r-uxhrn-tuxFAZk0M0J7Xak
layout-apps-and-files--files-collapsed--dark:
hash: v1.k794b7964.118ebf1ae04d48007beb2f7ea15bf13d6305990b4968c34c97a8cf39ceff8dfc.9TT8VirZZo2xhPYlEtB-9SFnMqrKNKVJ5VEiN3lhIsM
layout-apps-and-files--files-collapsed--light:
hash: v1.k794b7964.9a8deb1dce4ada9ffdd59c7c1fd2e7b8a4272cecd7e7ea1ff05c1400ad0d415b.y96NUpIiIZj5kA2vRmF_0wVyJ6hVDFYLf99e1KnYQ7Y
layout-apps-and-files--files-dark--dark:
- hash: v1.k794b7964.104706ddcb2e161b6299b46246ce691e32ad60617b388a66065a7296d1b075d4.VByrpBF1fTjVBa8qUFC3ugclmy3-laBo1VYK44VfIOI
+ hash: v1.k794b7964.e724be4ea053f69550dafc783c88c627819665dda7e6631348f50539cfd8db56.km-sygfloLSmaZqn1G6kgNFSoAIT1XtuNzEkx7TkZyY
layout-apps-and-files--files-dark--light:
- hash: v1.k794b7964.df29aea695958189cd31131f839c869bd986a11e4fde4498d4aa1c1c0d590f0d.hhSOPVxWCO3A0UHF-XFhEbcxaG67u82F0leXmyl6zOY
+ hash: v1.k794b7964.1796122c9845e212ffe56cac79292ba2afa29d14f1f3edbea7e8132cfddb1a6c.XUkc8yPYA4ipHtkHw0KhxG8Nik4FegNHiII2x0bx6vQ
layout-apps-and-files--files-empty-starred--dark:
- hash: v1.k794b7964.4e71b00aa4d355ac49c52e8dcf3c952a3063c93edb63fea0bb3b9f0ddd07f4c4.PP59H--PuMxK9iCjquCB9KgGiTGwUQTSguLwOlNJlBg
+ hash: v1.k794b7964.55abba68254b68574e615106f1e87ee38ac2cbf2896160d840934aa58f9564ab.CCRwvPAKl1ULxSGmZepIJ34_cPkfzGNOhvKLwFv5p4I
layout-apps-and-files--files-empty-starred--light:
- hash: v1.k794b7964.b2ed1f4752a078dcabeb5cbaa69a8fd95123aa2ae886a059b33f44ab5d9a8228.zCeI9kP7lfRasU0pYyjocJZWlqE9J4U7yILWzwR2Nps
+ hash: v1.k794b7964.aab038b29d08a124e0fe7434a7e260a025f80a89b2edb59bcbb3794f192064e8.rbDdLaSYyISz_t6IZWK8ryHz9NuelOeIEv6SkY8oY_Q
+ layout-apps-and-files--files-filtered--dark:
+ hash: v1.k794b7964.9b71c79f387cb1f01c88c00e21e9f5afd30f69928db9734c06d1f88ae4a65700.kkvLuXvTfwl-ibAMxZHnIbWA3RNZF_kfmnW22fp5gEY
+ layout-apps-and-files--files-filtered--light:
+ hash: v1.k794b7964.6e50ffc1b19a63357c9aac718f5188580e723ed601ed2e5da42b39dbb4b652f1.BE3XXbIGb_cV28owLU63HzyV3DvtvyMvEt3MaNVXTtI
layout-apps-and-files--files-long-tree--dark:
- hash: v1.k794b7964.0b4d9757f139ee445bbed56a95ff3d1d7adea8cff3e352f9c22b2834cddc4587.nmclztcjsUgsJ5tZm4BbhTPWD2Y0a3dNCDWKiFVIC9w
+ hash: v1.k794b7964.728514bf84f1c3ba77b9d86ef1b4440a716896471531f604fb2db1479ebdf0c0.wWuH5VevHCic5Z-hp3C7JlqpBv4omh6Ntyn_HKesedI
layout-apps-and-files--files-long-tree--light:
- hash: v1.k794b7964.8fdc5e33f1b0b9965cc59a09c4c3fe108226d22b0c49aa6eba06191d9642b5cf.2FpsToivS8IJtG0cZfIRclE6Rt7I60Plb2GFFWyt4f8
+ hash: v1.k794b7964.2425b8020520c9afcd45a8d5dfab54d7c62b7bcffb3c5a4faf957abf22c5ed76.CdDQWC02Rxa-EnhUs07hPYZJugGveJxyxQB8KC9mBCI
layout-apps-and-files--files-narrow--dark:
- hash: v1.k794b7964.e878708df213b23553ff1b23ac464be8008ac2ed112953d749032ea258c9d264.SLpdWlotXmAJqz1BlmQRwdZAGa7NH0Z_Ixw1So3LEi8
+ hash: v1.k794b7964.5e9c778e138bb5f8bfe30986b5e440a5a153c34504dec6ba3952522c9e690099.xpd1CRxcdVAlMdph54in7XdBStK7KHxYwe2KD1P229k
layout-apps-and-files--files-narrow--light:
- hash: v1.k794b7964.563c396271379b8d74b83fc1a637ce2bf5bdfdb2398bbd2528d8062d1687c45b.OGgTNL3VtJ5OiiNvuqBoIqgBHxH28bUN5YHAwu3xUqU
+ hash: v1.k794b7964.a2bd4e4c51bc9809a5ffb9e778dea883365fdbf2fbfc7c8893bf543cc98b441f.rrF_3cH4KiKeOQTwAsNob-0Smfq18Fy29HlQkykcNOY
layout-apps-and-files--files-no-results--dark:
- hash: v1.k794b7964.520a9a4a7818cf705c3d545d0c1e3ce0e6607bf75450ef05db8703d41e56d556.r_5CLFccQmHuLI-AE90hfDksgx2wClJSxn_XROYej08
+ hash: v1.k794b7964.f3f8d4d6d5f654c5212ddcfa6a1ed049d0743244ef07ac6fb63c54b7286e99b2.ohEKYbpqKeafZp6jNgGL9S3iCL_L7d7bM9KJyuLzwCM
layout-apps-and-files--files-no-results--light:
- hash: v1.k794b7964.e993ac323fcc2e7314c18b26d909b605a0a2cbbc24ec100a734865379de76a33.zGuiK8eRmv5GLUPd23sZ0hypHU_C1yATA36rQSASueg
+ hash: v1.k794b7964.39de89d140193b713b009d4cd6d304e3ef40e2b62866e16eb0cfa9d3499d443f.mk173cSWWxx4p7PViw_UkgXqvqyYsiLorREWiAzwbts
+ layout-apps-and-files--files-only-mine--dark:
+ hash: v1.k794b7964.2621851dfc45fb850d8a13853b08336b3cc8185a787e3d1d7d20569c508de575.EYAXtUO87ltbZUvnPnTwU8xfXw27BtGVl9LUKq33kL0
+ layout-apps-and-files--files-only-mine--light:
+ hash: v1.k794b7964.c0bb13914ab03e13d8bd0701b995f57b0fc037a1a07744a478044903477d67bd.FvJ0XuQJ1D6edSL4zsDX39ZPY3MJe-OWGsH7ieFaxZo
+ layout-apps-and-files--files-options--dark:
+ hash: v1.k794b7964.2288a9f2a05cd89aacf34bc19e3071d9f07a1a32b1d55f70bcdbb82d1cbf266b.By05UMGM-8vqnaR85wHKMkhCjAx9zgB9yvUy6fO9Axo
+ layout-apps-and-files--files-options--light:
+ hash: v1.k794b7964.ed863f1564a3c215dfc620720af4fe0b79c754ca3fa692e1f84ae4a7e2635c0d.Ljbq_1BHVQgk1sOEGHVRwlBTWjLX8TBVeLq3VjIBalY
layout-apps-and-files--files-overlay--dark:
- hash: v1.k794b7964.1d36299d5317139cd1031b1d84dea57ee96f9a609b890c53aaacea6316a572ab.NMveVHHCaU3Wt4QRH7_0a0zDUqc-grJmnhtQsTUaF9E
+ hash: v1.k794b7964.efc40e369650dbd8034d07b8b43106ed3f8fe13ad71251644f47cfe063200cc8._FBPqGDSA-PbaUhdgLH-EGdQrQbYr2KrkZSBxzfNUWg
layout-apps-and-files--files-overlay--light:
- hash: v1.k794b7964.98b97f6d89df60074f943d799c62288032bb60dab3d5e35e55d570c3e468528e.7zqC2PhGv1G_qIDXjIhZt2TgP4AklFzkXRdpwXXhT58
+ hash: v1.k794b7964.8bb26635a9456756f8c27bafbbb832a9d2f156c7e85806f86efa9fa51420c7bd.kKrv3UiS9BtEe4sy1hcJFWKuGouN-I7ChMJZpJGUINE
layout-apps-and-files--files-recents-collapsed--dark:
- hash: v1.k794b7964.28cd7a2ad872ca532324bb65e3eb08a26002fecf15bf0562655bdd30b3ae3bea.BnZg92SRhE1PO4XjYTwlplEL-lL23dKM3Sr2MJoz0os
+ hash: v1.k794b7964.eb983a3f039847eac047686d0ee21688c90d70ac627f83e5c996feaad75f9db9.LX_RpKzAIgmsovDrYyjywWZi3a-eoSDIV2iKWezglVI
layout-apps-and-files--files-recents-collapsed--light:
- hash: v1.k794b7964.115f90e6214c5b3eabf1f6bde00a22addf5fb20f1f24438fa796e28a1f4f5461.NfMzKA73NUrs0rZAC6156iPEBOxnaXMhzXnVbMU0BZk
+ hash: v1.k794b7964.72bf9d1b7153a3965f6b9dfb5d672ffa0cd3d06c0a5b5b172dc963a421403a7c.I55hP1_r2xWr38vEaV7knzSB4l_I9K9APMqH4UlUV90
layout-apps-and-files--files-search--dark:
- hash: v1.k794b7964.24642b1c01d9bfbae46e9f2dcac8df9a8e22f90d04d7796143eee64dd573a163.ynjmBE0DXjNqnAzWDHhAHr2f_1Tutb_ZUbhsuVjfzSM
+ hash: v1.k794b7964.b958ac0c8e1198066406edc391c5b4e33d72fd811881c8ecf876d5bb7696b45d.whaQyQqn9BhA22GHLRuIlzwQqJNrmP3cwV5OaqtYENU
layout-apps-and-files--files-search--light:
- hash: v1.k794b7964.d07383e0de021c4edd46c75325d79445616f8618e3a2c80b2ca63b0fe68e06df.q7z8cya3S2kpbx5DzbDxmgpo2G1btmjjvs6Ie7oU-qI
+ hash: v1.k794b7964.ffcff42dab13cfa49e88ede59c5f2015d9847562a57d69137f0c46e465b7b476.K1jGPXvLCAkxdGAd9213Qw5Y8NZCbWeQNC4cJtHUfaM
layout-apps-and-files--flag-off--dark:
hash: v1.k794b7964.1d2bc7478dae3a6a9f01dea82d349773021591a51bfc8350ad86a9427400b980.pjx9o1-yZUZYLwWK1yCxPmCE6XmaK2UKX7yX5Bdv1nk
layout-apps-and-files--flag-off--light:
@@ -3813,21 +3825,21 @@ snapshots:
layout-apps-and-files--flag-off-flat-nav--light:
hash: v1.k794b7964.394c03467e2594ff67bc80ef82e12abdd02a572bf94fa4d8efeb6175899444cf.kbwibhKTNB1UnDA7vr6xgoAFGLCz6WDD4PCylFdYW1Q
layout-apps-and-files--narrow--dark:
- hash: v1.k794b7964.2f4d6cf8b34aaedc6670b776a80cf9d32ae855901dff8826d2a30e4faea8b6ca.q7Xk7fp59t9_5y-eZoT-H8fmAnTtF38mIfZgbkKwYb8
+ hash: v1.k794b7964.ee4d777fbc08fcb0d226ccef9261afa92e7649768bd6951c9445c83969b3fa4d.GGBfjVGieeEFKpnSLLl5-pVw2QQicKrFa01qF2X-h4s
layout-apps-and-files--narrow--light:
- hash: v1.k794b7964.77ac196b72757d2c4d9e4422b3a4d0921c44f444638171be236a79f56f68666b.I-wwEqM6y-pob3l3vkAaWaZDakVnjoHn8AXkgHFks_4
+ hash: v1.k794b7964.be79d9f7dc66e6fc28dbec24d39b865b6a78d48a245e0b1c3d170243b63958ca.QXSYOi0nVq27q6iXepJ6JgYb-mtNlAGDHinHNoGtF4c
layout-apps-and-files--no-results--dark:
- hash: v1.k794b7964.88bb1c5716f71d0bec9e72d9f0eb3357242893c005dd4fe51b4623d4a914a630.MpyezT0JDw30KglY7NzLugWmyjn_FEqtPOGfhFzrvEo
+ hash: v1.k794b7964.c125869fed1d4bc2ebf00909b71041e771005c4a0f05ca4218fa9d9b805dfbb2.5lZou1rhGwwewRw2isKTrs4kukBrLu7vcUipiU3epXo
layout-apps-and-files--no-results--light:
- hash: v1.k794b7964.c5bd4fab104b89d30f36184d8fbaeeec5c5b5868da1e9cc210fbcf00871e9454.ydynNa6_mx3tOqZX3b6YDtIRUT7_lOyeSLv_LDtzF8o
+ hash: v1.k794b7964.4d27bd9f7fea6b2b8769caa285f7a2258867cdd0f00c10477ca380252185dcdd.0UCneKeN8U6nuC3IcuHB-j-qclxIsW37wdLRXx-b6q4
layout-apps-and-files--open-folder--dark:
- hash: v1.k794b7964.32274fcb3c9a7956285be7ee7d957ebe3bb3e7b4f1b43a8d580bd3ef0c5fd669.aqcnzaSb_BU0A1akwyAGsEi9RRuzOtQXJPJ5Wdo9CYw
+ hash: v1.k794b7964.68c4fa1b8c5dea32ab610ae5ea7226bbf85e60bbfff6ac26a8f497aeaa746758.-Hr5cfpXewwt7IFlOJ0al5EB0ZLMHto-lF_LHDw8ZrQ
layout-apps-and-files--open-folder--light:
- hash: v1.k794b7964.22fd482f64ea49fd1090c0add5984fbd2cb9e68ae3bc2361c3153396c91ac21c.dPJASLY-SsDpL_bEKqNSR0eyVjeFx1qolOFVRkVqpdk
+ hash: v1.k794b7964.28dd167436551192e764e4fed5468ddc856b81bed5353c002920cb180779e3e2.SaDvtRYvcrXuEooigvSEZe7m9kr5traGGJ9nzgczpT4
layout-apps-and-files--search--dark:
- hash: v1.k794b7964.0d5dac8468bbf845be2be38b812086592d4be9574f4ced65e36648f71bc751cb.h6TF74-gkqhaI9nKbbdCNRZc_BpVsz4NK0wq1BBCCcU
+ hash: v1.k794b7964.ab08bda57a90af1540591082ea552bf0e5c894640c463fc780ff488410961453.psbQogafh58z-lpSRD1QVMzxMxd-MXo9c-zMSziPfaI
layout-apps-and-files--search--light:
- hash: v1.k794b7964.f41c48230aadbb2c976e7ee38796f6b5a1b8426f8dc49ae490e8649db281ea8d.GYUk0AWK6dQp53DyvWCusRg-neEXfKL9SU6JsTPf5uE
+ hash: v1.k794b7964.059d934765eb79a2dfff06d98d7103a1be20025910f463a3ade56ac04ab4a6cb.RDXSmnTC3r3reciwNi7FbelVrLSqeAmAfLjvCkCIDjM
layout-apps-app-tooltip--dark--dark:
hash: v1.k794b7964.52ba01b050e579d7c600df08497a2dfab2dba9cf670553e032afce3819d6d00d.4TCn-X9vJ_FhNwb6WjhB2V_zEkQCnG4FoEE7hf6L9-o
layout-apps-app-tooltip--dark--light:
diff --git a/frontend/src/layout/panel-layout/ProjectTree/ProjectTree.tsx b/frontend/src/layout/panel-layout/ProjectTree/ProjectTree.tsx
index 9b775c70e6df..72f604fc89e3 100644
--- a/frontend/src/layout/panel-layout/ProjectTree/ProjectTree.tsx
+++ b/frontend/src/layout/panel-layout/ProjectTree/ProjectTree.tsx
@@ -171,7 +171,6 @@ export function ProjectTree(props: ProjectTreeProps): JSX.Element {
setEditingItemId,
setSortMethod,
setSelectMode,
- setSearchTerm,
} = useActions(projectTreeLogic(projectTreeLogicProps))
const selectMode = selectModeOverride ?? projectTreeSelectMode
@@ -660,11 +659,7 @@ export function ProjectTree(props: ProjectTreeProps): JSX.Element {
/>
</BindLogic>
}
- filterDropdown={
- showFilterDropdown ? (
- <TreeFiltersDropdownMenu setSearchTerm={setSearchTerm} searchTerm={searchTerm} />
- ) : null
- }
+ filterDropdown={showFilterDropdown ? <TreeFiltersDropdownMenu logicProps={projectTreeLogicProps} /> : null}
panelMenuItems={
showSortMenuItems ? <TreeSortMenuItems sortMethod={sortMethod} setSortMethod={setSortMethod} /> : null
}
diff --git a/frontend/src/layout/panel-layout/ProjectTree/TreeFiltersDropdownMenu.tsx b/frontend/src/layout/panel-layout/ProjectTree/TreeFiltersDropdownMenu.tsx
index ce711fc20ab6..3c7b754fa6e5 100644
--- a/frontend/src/layout/panel-layout/ProjectTree/TreeFiltersDropdownMenu.tsx
+++ b/frontend/src/layout/panel-layout/ProjectTree/TreeFiltersDropdownMenu.tsx
@@ -1,130 +1,25 @@
-import { useValues } from 'kea'
+import { IconFilter } from '@posthog/icons'
+import { LemonButton, LemonMenu } from '@posthog/lemon-ui'
-import { IconCheck, IconFilter } from '@posthog/icons'
-
-import { IconBlank } from 'lib/lemon-ui/icons'
-import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
-import { ButtonPrimitive } from 'lib/ui/Button/ButtonPrimitives'
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuRadioGroup,
- DropdownMenuRadioItem,
- DropdownMenuSeparator,
- DropdownMenuTrigger,
-} from 'lib/ui/DropdownMenu/DropdownMenu'
-
-import { fileSystemTypes } from '~/products'
-import { FileSystemType } from '~/types'
+import { ProjectTreeLogicProps } from './projectTreeLogic'
+import { useTreeFilterMenuItems } from './useTreeFilterMenuItems'
interface FiltersDropdownProps {
- setSearchTerm: (searchTerm: string) => void
- searchTerm: string
+ logicProps: ProjectTreeLogicProps
}
-const missingProductTypes: { value: string; label: string; flag?: string }[] = [
- { value: 'destination', label: 'Destinations' },
- { value: 'site_app', label: 'Web scripts' },
- { value: 'source', label: 'Sources' },
- { value: 'transformation', label: 'Transformations' },
-]
-// TODO: This is a duplicate of TreeSearchField.tsx
-const productTypesMapped = [
- ...Object.entries(fileSystemTypes as unknown as Record<string, FileSystemType>).map(
- ([key, value]): { value: string; label: string; flag?: string } => ({
- value: value.filterKey || key,
- label: value.name,
- flag: value.flag,
- })
- ),
- ...missingProductTypes,
-]
-
-export function TreeFiltersDropdownMenu({ setSearchTerm, searchTerm }: FiltersDropdownProps): JSX.Element {
- const { featureFlags } = useValues(featureFlagLogic)
-
- const removeTagsStarting = (str: string, tag: string): string =>
- str
- .split(' ')
- .filter((p) => !p.startsWith(tag))
- .join(' ')
- .trim()
- const removeTagsEquals = (str: string, tag: string): string =>
- str
- .split(' ')
- .filter((p) => p != tag)
- .join(' ')
- .trim()
- const addTag = (str: string, tag: string): string => `${str.trim()} ${tag.trim()}`.trim()
+export function TreeFiltersDropdownMenu({ logicProps }: FiltersDropdownProps): JSX.Element {
+ const items = useTreeFilterMenuItems(logicProps)
return (
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <ButtonPrimitive
- iconOnly
- data-attr="tree-filters-dropdown-menu-trigger-button"
- tooltip="Tree filters"
- tooltipPlacement="bottom"
- >
- <IconFilter className="size-3 text-tertiary" />
- </ButtonPrimitive>
- </DropdownMenuTrigger>
- <DropdownMenuContent loop align="end" side="bottom" className="max-w-[250px]">
- <DropdownMenuRadioGroup>
- <DropdownMenuRadioItem
- asChild
- value="user:me"
- onClick={() => {
- setSearchTerm(
- searchTerm.includes('user:me')
- ? removeTagsEquals(searchTerm, 'user:me')
- : addTag(searchTerm, 'user:me')
- )
- }}
- >
- <ButtonPrimitive
- menuItem
- data-attr="tree-filters-dropdown-menu-only-my-stuff-button"
- active={searchTerm.includes('user:me')}
- >
- {searchTerm.includes('user:me') ? <IconCheck /> : <IconBlank />}
- Only my stuff
- </ButtonPrimitive>
- </DropdownMenuRadioItem>
- <DropdownMenuSeparator />
- {productTypesMapped
- .filter(
- (productType) =>
- !productType.flag || featureFlags[productType.flag as keyof typeof featureFlags]
- )
- .map((productType) => (
- <DropdownMenuRadioItem
- asChild
- key={productType.value}
- value={productType.value}
- onClick={() => {
- setSearchTerm(
- searchTerm.includes(`type:${productType.value}`)
- ? removeTagsStarting(searchTerm, 'type:')
- : addTag(
- removeTagsStarting(searchTerm, 'type:'),
- `type:${productType.value}`
- )
- )
- }}
- >
- <ButtonPrimitive
- menuItem
- data-attr={`tree-filters-dropdown-menu-${productType.value}-button`}
- active={searchTerm.includes(`type:${productType.value}`)}
- >
- {searchTerm.includes(`type:${productType.value}`) ? <IconCheck /> : <IconBlank />}
- {productType.label}
- </ButtonPrimitive>
- </DropdownMenuRadioItem>
- ))}
- </DropdownMenuRadioGroup>
- </DropdownMenuContent>
- </DropdownMenu>
+ <LemonMenu items={items} placement="bottom-end">
+ <LemonButton
+ size="xsmall"
+ icon={<IconFilter />}
+ data-attr="tree-filters-dropdown-menu-trigger-button"
+ tooltip="Tree filters"
+ aria-label="Tree filters"
+ />
+ </LemonMenu>
)
}
diff --git a/frontend/src/layout/panel-layout/ProjectTree/projectTreeLogic.tsx b/frontend/src/layout/panel-layout/ProjectTree/projectTreeLogic.tsx
index 3ed3afecb409..5ed567fea6e2 100644
--- a/frontend/src/layout/panel-layout/ProjectTree/projectTreeLogic.tsx
+++ b/frontend/src/layout/panel-layout/ProjectTree/projectTreeLogic.tsx
@@ -124,6 +124,10 @@ export interface projectTreeLogicValues {
recentResultsLoading: boolean
recentTreeItems: TreeDataItem[]
scrollTargetId: string
+ searchFilters: {
+ fileType: string | null
+ onlyMine: boolean
+ }
searchResults: SearchResults
searchResultsLoading: boolean
searchTerm: string
@@ -432,6 +436,9 @@ export interface projectTreeLogicActions {
setTreeTableColumnSizes: (sizes: number[]) => {
sizes: number[]
}
+ toggleFileTypeFilter: (fileType: string) => {
+ fileType: string
+ }
toggleFolderOpen: (
folderId: string,
isExpanded: boolean
@@ -439,12 +446,19 @@ export interface projectTreeLogicActions {
folderId: string
isExpanded: boolean
}
+ toggleOnlyMyStuff: () => {
+ value: true
+ }
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface projectTreeLogicMeta {
key: string
__keaTypeGenInternalSelectorTypes: {
+ searchFilters: (searchTerm: string) => {
+ fileType: string | null
+ onlyMine: boolean
+ }
projectTree: (
viableItems: FileSystemEntry[],
folderStates: Record<string, FolderState>,
@@ -604,6 +618,8 @@ export const projectTreeLogic = kea<projectTreeLogicType>([
callback,
}),
setSearchTerm: (searchTerm: string) => ({ searchTerm }),
+ toggleOnlyMyStuff: true,
+ toggleFileTypeFilter: (fileType: string) => ({ fileType }),
clearSearch: true,
loadSearchResults: (searchTerm: string, offset = 0) => ({ searchTerm, offset }),
loadRecentResults: (type: 'start' | 'end') => ({ type }),
@@ -914,6 +930,16 @@ export const projectTreeLogic = kea<projectTreeLogicType>([
],
})),
selectors({
+ searchFilters: [
+ (s) => [s.searchTerm],
+ (searchTerm: string): { onlyMine: boolean; fileType: string | null } => {
+ const tags = searchTerm.split(' ')
+ return {
+ onlyMine: tags.includes('user:me'),
+ fileType: tags.find((tag) => tag.startsWith('type:'))?.slice(5) ?? null,
+ }
+ },
+ ],
projectTree: [
(s) => [s.viableItems, s.folderStates, s.checkedItems, s.users, s.onlyFolders],
(
@@ -1605,6 +1631,27 @@ export const projectTreeLogic = kea<projectTreeLogicType>([
setSearchTerm: ({ searchTerm }) => {
actions.loadSearchResults(searchTerm)
},
+ toggleOnlyMyStuff: () => {
+ actions.setSearchTerm(
+ values.searchFilters.onlyMine
+ ? values.searchTerm
+ .split(' ')
+ .filter((tag) => tag !== 'user:me')
+ .join(' ')
+ .trim()
+ : `${values.searchTerm.trim()} user:me`.trim()
+ )
+ },
+ toggleFileTypeFilter: ({ fileType }) => {
+ const withoutType = values.searchTerm
+ .split(' ')
+ .filter((tag) => !tag.startsWith('type:'))
+ .join(' ')
+ .trim()
+ actions.setSearchTerm(
+ values.searchFilters.fileType === fileType ? withoutType : `${withoutType} type:${fileType}`.trim()
+ )
+ },
setSortMethod: ({ sortMethod }) => {
posthog.capture('project tree sort changed', {
root: props.root ?? 'project://',
diff --git a/frontend/src/layout/panel-layout/ProjectTree/useTreeFilterMenuItems.tsx b/frontend/src/layout/panel-layout/ProjectTree/useTreeFilterMenuItems.tsx
new file mode 100644
index 000000000000..fdcf678b184b
--- /dev/null
+++ b/frontend/src/layout/panel-layout/ProjectTree/useTreeFilterMenuItems.tsx
@@ -0,0 +1,66 @@
+import { useActions, useValues } from 'kea'
+
+import { IconCheck } from '@posthog/icons'
+
+import { IconBlank } from 'lib/lemon-ui/icons'
+import { LemonMenuSection } from 'lib/lemon-ui/LemonMenu'
+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
+
+import { fileSystemTypes } from '~/products'
+import { FileSystemType } from '~/types'
+
+import { ProjectTreeLogicProps, projectTreeLogic } from './projectTreeLogic'
+
+const missingProductTypes: { value: string; label: string; flag?: string }[] = [
+ { value: 'destination', label: 'Destinations' },
+ { value: 'site_app', label: 'Web scripts' },
+ { value: 'source', label: 'Sources' },
+ { value: 'transformation', label: 'Transformations' },
+]
+// TODO: This is a duplicate of TreeSearchField.tsx
+const productTypesMapped = [
+ ...Object.entries(fileSystemTypes as unknown as Record<string, FileSystemType>).map(
+ ([key, value]): { value: string; label: string; flag?: string } => ({
+ value: value.filterKey || key,
+ label: value.name,
+ flag: value.flag,
+ })
+ ),
+ ...missingProductTypes,
+]
+
+export function useTreeFilterMenuItems(logicProps: ProjectTreeLogicProps): LemonMenuSection[] {
+ const { featureFlags } = useValues(featureFlagLogic)
+ const { searchFilters } = useValues(projectTreeLogic(logicProps))
+ const { toggleOnlyMyStuff, toggleFileTypeFilter } = useActions(projectTreeLogic(logicProps))
+
+ return [
+ {
+ items: [
+ {
+ label: 'Only my stuff',
+ icon: searchFilters.onlyMine ? <IconCheck /> : <IconBlank />,
+ active: searchFilters.onlyMine,
+ 'data-attr': 'tree-filters-dropdown-menu-only-my-stuff-button',
+ onClick: toggleOnlyMyStuff,
+ },
+ ],
+ },
+ {
+ items: productTypesMapped
+ .filter(
+ (productType) => !productType.flag || featureFlags[productType.flag as keyof typeof featureFlags]
+ )
+ .map((productType) => {
+ const active = searchFilters.fileType === productType.value
+ return {
+ label: productType.label,
+ icon: active ? <IconCheck /> : <IconBlank />,
+ active,
+ 'data-attr': `tree-filters-dropdown-menu-${productType.value}-button`,
+ onClick: () => toggleFileTypeFilter(productType.value),
+ }
+ }),
+ },
+ ]
+}
diff --git a/frontend/src/layout/panel-layout/navbar/AppsAndFiles.stories.tsx b/frontend/src/layout/panel-layout/navbar/AppsAndFiles.stories.tsx
index 246a094ce0de..a8a54ff00bd4 100644
--- a/frontend/src/layout/panel-layout/navbar/AppsAndFiles.stories.tsx
+++ b/frontend/src/layout/panel-layout/navbar/AppsAndFiles.stories.tsx
@@ -1,6 +1,8 @@
import { MOCK_DEFAULT_BASIC_USER } from 'lib/api.mock'
import type { Meta, StoryObj } from '@storybook/react'
+import { within } from '@testing-library/dom'
+import userEvent from '@testing-library/user-event'
import { useActions, useMountedLogic } from 'kea'
import { FEATURE_FLAGS } from 'lib/constants'
@@ -42,6 +44,7 @@ const files: FileSystemEntry[] = [
},
{ id: 'flag-1', path: 'New checkout', type: 'feature_flag', ref: '1', href: '/feature_flags/1' },
]
+const ownedFileIds = new Set(['dashboard-1', 'notebook-1'])
const starred: FileSystemEntry[] = [
{ id: 'star-home', path: 'Alex Example', type: 'folder', ref: 'Users/Alex Example' },
{ id: 'star-1', path: 'Product analytics', type: 'product_analytics', href: '/insights' },
@@ -113,10 +116,22 @@ const meta: Meta<typeof SidebarStory> = {
const params = new URL(req.url).searchParams
const parent = params.get('parent')
const search = params.get('search')?.toLowerCase() ?? ''
+ const type = search
+ .split(' ')
+ .find((part) => part.startsWith('type:'))
+ ?.slice(5)
+ const query = search
+ .split(' ')
+ .filter((part) => !part.includes(':'))
+ .join(' ')
+ const onlyMine = search.split(' ').includes('user:me')
const results = files.filter((file) =>
parent !== null
? file.path.split('/').slice(0, -1).join('/') === parent
- : file.type !== 'folder' && file.path.toLowerCase().includes(search)
+ : file.type !== 'folder' &&
+ (!onlyMine || ownedFileIds.has(file.id)) &&
+ (!type || file.type === type) &&
+ file.path.toLowerCase().includes(query)
)
return [200, { results, count: results.length, next: null, has_more: false }]
},
@@ -143,6 +158,22 @@ export default meta
type Story = StoryObj<typeof SidebarStory>
export const Apps: Story = {}
export const Files: Story = { args: { tab: 'files' } }
+export const FilesOptions: Story = {
+ ...Files,
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement)
+ const body = within(canvasElement.ownerDocument.body)
+ const options = await canvas.findByLabelText('Files options')
+ await userEvent.click(options)
+ await userEvent.click(body.getByText('Filters', { exact: true }))
+ await userEvent.click(body.getByText('Only my stuff', { exact: true }))
+ await userEvent.click(body.getByText('Notebook', { exact: true }))
+ await userEvent.click(body.getByText('Only my stuff', { exact: true }))
+ await userEvent.click(body.getByText('Notebook', { exact: true }))
+ await userEvent.click(canvasElement.ownerDocument.body)
+ await userEvent.click(options)
+ },
+}
export const OpenFolder: Story = { args: { collapsed: true, folderToOpen: 'Product research' } }
export const Chat: Story = {
args: { tab: 'chat' },
@@ -169,6 +200,8 @@ export const Chat: Story = {
],
}
export const FilesSearch: Story = { args: { tab: 'files', search: 'Weekly' } }
+export const FilesFiltered: Story = { args: { tab: 'files', search: 'type:notebook' } }
+export const FilesOnlyMine: Story = { args: { tab: 'files', search: 'user:me' } }
export const FilesNoResults: Story = { args: { tab: 'files', search: 'nothing-matches' } }
export const Search: Story = { args: { search: 'data' } }
export const NoResults: Story = { args: { search: 'nothing-matches' } }
diff --git a/frontend/src/layout/panel-layout/navbar/tabs/NavFilesMenu.tsx b/frontend/src/layout/panel-layout/navbar/tabs/NavFilesMenu.tsx
new file mode 100644
index 000000000000..cc2bd9312597
--- /dev/null
+++ b/frontend/src/layout/panel-layout/navbar/tabs/NavFilesMenu.tsx
@@ -0,0 +1,76 @@
+import { useActions, useValues } from 'kea'
+import posthog from 'posthog-js'
+
+import { IconCheckbox, IconEllipsis, IconFilter, IconFolderPlus } from '@posthog/icons'
+import { LemonButton, LemonMenu } from '@posthog/lemon-ui'
+
+import { projectTreeDataLogic } from '../../ProjectTree/projectTreeDataLogic'
+import { projectTreeLogic } from '../../ProjectTree/projectTreeLogic'
+import { useTreeFilterMenuItems } from '../../ProjectTree/useTreeFilterMenuItems'
+import { FILES_TREE_KEY } from './navFilesTabLogic'
+
+export function NavFilesMenu(): JSX.Element {
+ const logic = projectTreeLogic({ key: FILES_TREE_KEY, root: 'project://' })
+ const { selectMode, searchTerm } = useValues(logic)
+ const { setSelectMode, createFolder } = useActions(logic)
+ const { pendingLoaderLoading } = useValues(projectTreeDataLogic)
+ const filterItems = useTreeFilterMenuItems({ key: FILES_TREE_KEY, root: 'project://' })
+
+ return (
+ <LemonMenu
+ placement="bottom-end"
+ items={[
+ {
+ items: [
+ {
+ label: selectMode === 'default' ? 'Enable multi-select' : 'Disable multi-select',
+ icon: <IconCheckbox />,
+ active: selectMode === 'multi',
+ 'data-attr': 'tree-panel-enable-multi-select-button',
+ onClick: () => {
+ posthog.capture('project tree multi-select toggled', {
+ root: 'project://',
+ enabled: selectMode === 'default',
+ })
+ setSelectMode(selectMode === 'default' ? 'multi' : 'default')
+ },
+ },
+ ],
+ },
+ {
+ items: [
+ {
+ label: 'Filters',
+ icon: <IconFilter />,
+ active: !!searchTerm.trim(),
+ items: filterItems.flatMap((section) => section.items),
+ closeOnClickInside: false,
+ closeParentPopoverOnClickInside: false,
+ 'data-attr': 'tree-filters-dropdown-menu-trigger-button',
+ },
+ ],
+ },
+ {
+ items: [
+ {
+ label: 'New root folder',
+ icon: <IconFolderPlus />,
+ 'data-attr': 'tree-panel-new-root-folder-button',
+ disabledReason: pendingLoaderLoading ? 'Saving changes...' : undefined,
+ onClick: () => createFolder(''),
+ },
+ ],
+ },
+ ]}
+ >
+ <LemonButton
+ size="xsmall"
+ icon={<IconEllipsis />}
+ tooltip="Files options"
+ aria-label="Files options"
+ data-attr="tree-panel-options-button"
+ active={!!searchTerm.trim() || selectMode === 'multi'}
+ />
+ </LemonMenu>
+ )
+}
diff --git a/frontend/src/layout/panel-layout/navbar/tabs/NavTabApps.tsx b/frontend/src/layout/panel-layout/navbar/tabs/NavTabApps.tsx
index 4a8eebfc6d8d..10b54c2fb10f 100644
--- a/frontend/src/layout/panel-layout/navbar/tabs/NavTabApps.tsx
+++ b/frontend/src/layout/panel-layout/navbar/tabs/NavTabApps.tsx
@@ -1,7 +1,6 @@
-import { useActions, useValues } from 'kea'
+import { useValues } from 'kea'
-import { IconSearch } from '@posthog/icons'
-import { LemonInput, Spinner } from '@posthog/lemon-ui'
+import { Spinner } from '@posthog/lemon-ui'
import { ScrollableShadows } from 'lib/components/ScrollableShadows/ScrollableShadows'
@@ -14,7 +13,6 @@ import { NavTabSection } from './NavTabSection'
export function NavTabApps(): JSX.Element {
const { search, groupedItems } = useValues(navAppsTabLogic)
- const { setSearch } = useActions(navAppsTabLogic)
const { shortcutDataHasLoaded } = useValues(projectTreeDataLogic)
const { fullFileSystemFiltered: starredApps } = useValues(
projectTreeLogic({ key: APPS_STARRED_TREE_KEY, root: 'shortcuts://', shortcutScope: 'apps' })
@@ -22,24 +20,6 @@ export function NavTabApps(): JSX.Element {
return (
<div className="flex flex-col h-full min-h-0 group/colorful-product-icons colorful-product-icons-true">
- <div className="p-1">
- <LemonInput
- type="search"
- prefix={
- <div className="flex items-center justify-center size-4 ml-[2px] mr-px">
- <IconSearch className="size-4" />
- </div>
- }
- size="small"
- className="min-h-[30px]"
- placeholder="Filter apps"
- aria-label="Filter apps"
- value={search}
- onChange={setSearch}
- fullWidth
- data-attr="nav-apps-search"
- />
- </div>
<ScrollableShadows
direction="vertical"
className="flex-1 min-h-0"
diff --git a/frontend/src/layout/panel-layout/navbar/tabs/NavTabFiles.tsx b/frontend/src/layout/panel-layout/navbar/tabs/NavTabFiles.tsx
index d259cfb9952f..8957e1b1f7c4 100644
--- a/frontend/src/layout/panel-layout/navbar/tabs/NavTabFiles.tsx
+++ b/frontend/src/layout/panel-layout/navbar/tabs/NavTabFiles.tsx
@@ -2,11 +2,14 @@ import { useValues } from 'kea'
import { Spinner } from '@posthog/lemon-ui'
+import { ScrollableShadows } from 'lib/components/ScrollableShadows/ScrollableShadows'
+
import { panelLayoutLogic } from '../../panelLayoutLogic'
import { ProjectTree } from '../../ProjectTree/ProjectTree'
import { projectTreeDataLogic } from '../../ProjectTree/projectTreeDataLogic'
import { projectTreeLogic } from '../../ProjectTree/projectTreeLogic'
import { FlatNavRecents } from './flat-nav/FlatNavRecents'
+import { NavFilesMenu } from './NavFilesMenu'
import { FILES_STARRED_TREE_KEY, FILES_TREE_KEY, navFilesTabLogic } from './navFilesTabLogic'
import { NavTabSection } from './NavTabSection'
@@ -17,57 +20,62 @@ export function NavTabFiles(): JSX.Element {
const { fullFileSystemFiltered: starredFiles } = useValues(
projectTreeLogic({ key: FILES_STARRED_TREE_KEY, root: 'shortcuts://', shortcutScope: 'files' })
)
+ const showStarred = !searchTerm.trim() || !shortcutDataHasLoaded || starredFiles.length > 0
+
return (
- <div className="flex flex-col h-full min-h-0">
- <div className="flex-1 min-h-0">
- <ProjectTree
- panelName="files"
- root="project://"
- logicKey={FILES_TREE_KEY}
- searchPlaceholder="Filter files"
- showRecents
- layout="inline"
- beforeTree={
- (!searchTerm.trim() || !shortcutDataHasLoaded || starredFiles.length > 0) && (
- <div className="px-1 pb-2">
- <NavTabSection
- label="Starred"
- dataAttr="nav-files-starred-toggle"
- key={`starred-${!!searchTerm.trim()}`}
- >
- {!shortcutDataHasLoaded ? (
- <Spinner className="m-2" />
- ) : starredFiles.length > 0 ? (
- <ProjectTree
- root="shortcuts://"
- shortcutScope="files"
- logicKey={FILES_STARRED_TREE_KEY}
- onlyTree
- showShortcutHelp={false}
- />
- ) : (
- <p className="text-xs text-tertiary px-2 py-1 mb-0">
- Star files or folders to keep them here.
- </p>
- )}
- </NavTabSection>
- </div>
- )
- }
- renderTree={(tree) => (
- <div className="px-1">
- <NavTabSection
- label="Files"
- dataAttr="nav-files-project-toggle"
- key={`files-${!!searchTerm.trim()}-${folderRevealCount}`}
- >
- {tree}
- </NavTabSection>
- </div>
- )}
- isActiveInPanel={navExperimentActiveTab === 'files'}
- />
- </div>
+ <div
+ className="flex flex-col h-full min-h-0 group/colorful-product-icons colorful-product-icons-true"
+ data-attr="nav-panel-files"
+ >
+ <ScrollableShadows
+ direction="vertical"
+ className="flex-1 min-h-0"
+ innerClassName="relative px-1"
+ styledScrollbars
+ >
+ <div className="absolute top-0 right-1 z-10">
+ <NavFilesMenu />
+ </div>
+ {showStarred && (
+ <div className="pb-2">
+ <NavTabSection
+ label="Starred"
+ dataAttr="nav-files-starred-toggle"
+ key={`starred-${!!searchTerm.trim()}`}
+ actions={<span className="size-6.5 shrink-0" aria-hidden />}
+ >
+ {!shortcutDataHasLoaded ? (
+ <Spinner className="m-2" />
+ ) : starredFiles.length > 0 ? (
+ <ProjectTree
+ root="shortcuts://"
+ shortcutScope="files"
+ logicKey={FILES_STARRED_TREE_KEY}
+ onlyTree
+ showShortcutHelp={false}
+ />
+ ) : (
+ <p className="text-xs text-tertiary px-2 py-1 mb-0">
+ Star files or folders to keep them here.
+ </p>
+ )}
+ </NavTabSection>
+ </div>
+ )}
+ <NavTabSection
+ label="Files"
+ dataAttr="nav-files-project-toggle"
+ key={`files-${!!searchTerm.trim()}-${folderRevealCount}`}
+ actions={!showStarred && <span className="size-6.5 shrink-0" aria-hidden />}
+ >
+ <ProjectTree
+ root="project://"
+ logicKey={FILES_TREE_KEY}
+ onlyTree
+ isActiveInPanel={navExperimentActiveTab === 'files'}
+ />
+ </NavTabSection>
+ </ScrollableShadows>
<div className="max-h-1/3 overflow-y-auto px-2 border-t">
<FlatNavRecents />
</div>
diff --git a/frontend/src/layout/panel-layout/navbar/tabs/NavTabSection.tsx b/frontend/src/layout/panel-layout/navbar/tabs/NavTabSection.tsx
index bcce6ff1fcb2..29bb294631b1 100644
--- a/frontend/src/layout/panel-layout/navbar/tabs/NavTabSection.tsx
+++ b/frontend/src/layout/panel-layout/navbar/tabs/NavTabSection.tsx
@@ -7,19 +7,27 @@ export function NavTabSection({
collapsedLabel = label,
children,
dataAttr,
+ actions,
}: {
label: string
collapsedLabel?: string
children: ReactNode
dataAttr: string
+ actions?: ReactNode
}): JSX.Element {
const [open, setOpen] = useState(true)
return (
<Collapsible open={open} onOpenChange={setOpen}>
- <Collapsible.Trigger labelClassName="text-xs font-semibold text-secondary normal-case" data-attr={dataAttr}>
- <span>{open ? label : collapsedLabel}</span>
- </Collapsible.Trigger>
+ <div className="flex items-center justify-between">
+ <Collapsible.Trigger
+ labelClassName="text-xs font-semibold text-secondary normal-case"
+ data-attr={dataAttr}
+ >
+ <span>{open ? label : collapsedLabel}</span>
+ </Collapsible.Trigger>
+ {actions}
+ </div>
<Collapsible.Panel keepMounted>{children}</Collapsible.Panel>
</Collapsible>
)
diff --git a/frontend/src/layout/panel-layout/navbar/tabs/navFilesTabLogic.test.ts b/frontend/src/layout/panel-layout/navbar/tabs/navFilesTabLogic.test.ts
index 15eddf1b3406..4b64c05592d8 100644
--- a/frontend/src/layout/panel-layout/navbar/tabs/navFilesTabLogic.test.ts
+++ b/frontend/src/layout/panel-layout/navbar/tabs/navFilesTabLogic.test.ts
@@ -31,6 +31,28 @@ describe('navFilesTabLogic', () => {
expect(starred.values.fullFileSystemFiltered.map((item) => item.name)).toEqual(['Overview', 'Research'])
})
+ it('combines ownership and type filters without dropping text or desynchronizing starred files', () => {
+ const files = projectTreeLogic({ key: FILES_TREE_KEY, root: 'project://' })
+ const starred = projectTreeLogic({ key: FILES_STARRED_TREE_KEY, root: 'shortcuts://', shortcutScope: 'files' })
+
+ files.actions.setSearchTerm('Overview')
+ files.actions.toggleOnlyMyStuff()
+ files.actions.toggleFileTypeFilter('insight')
+ expect(files.values.searchTerm).toBe('Overview user:me type:insight')
+ expect(files.values.searchFilters).toEqual({ onlyMine: true, fileType: 'insight' })
+ expect(starred.values.searchTerm).toBe(files.values.searchTerm)
+
+ files.actions.toggleFileTypeFilter('dashboard')
+ expect(files.values.searchTerm).toBe('Overview user:me type:dashboard')
+
+ files.actions.toggleOnlyMyStuff()
+ expect(files.values.searchTerm).toBe('Overview type:dashboard')
+ files.actions.toggleFileTypeFilter('dashboard')
+ expect(files.values.searchTerm).toBe('Overview')
+ expect(files.values.searchFilters).toEqual({ onlyMine: false, fileType: null })
+ expect(starred.values.searchTerm).toBe('Overview')
+ })
+
it('reveals a folder in the files tab even when the navigation and folder are collapsed', async () => {
const files = projectTreeLogic({ key: FILES_TREE_KEY, root: 'project://' })
panelLayoutLogic.actions.setNavExperimentTab('home')